R Chintan Meher [Sun, 31 Aug 2025 00:50:56 +0000 (20:50 -0400)]
gh-133829: Remove some specifics from the ``zipimport`` example (#133835)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Tommaso Bona [Sat, 30 Aug 2025 10:27:32 +0000 (12:27 +0200)]
gh-138158: Use the `"data"` tarfile extraction filter in `Tools/ssl/multissltests.py` (#138147)
The `Tools/ssl/multissltests.py` script may extract a possibly untrusted tarball.
Since the script does not necessarily use Python 3.14 or later (where the `"data"`
filter became the default `tarfile` extraction filter), the user may theoretically
suffer from a path traversal attack.
Although the script should not be used in production and usually relies on downloading
trusted sources, the `"data"` extraction filter is now explicitly used wherever relevant.
Serhiy Storchaka [Wed, 27 Aug 2025 10:24:28 +0000 (13:24 +0300)]
gh-71679: Improve tests for repr() of bytes and bytearray (GH-138180)
* Merge existing tests test_repr_str and test_to_str.
* Add more tests for non-printable and non-ASCII bytes.
* Add tests for special escape sequences ('\t\n\r').
* Add tests for slashes.
* Add more tests for quotes.
* Add tests for subclasses.
* Add test for non-ASCII class name.
* Only apply @check_bytes_warnings for str() tests.
Rani Pinchuk [Tue, 26 Aug 2025 13:33:21 +0000 (15:33 +0200)]
gh-135427: Fix DeprecationWarning for os.fork when run in threads with -Werror (GH-136796)
Don't ignore errors raised by `PyErr_WarnFormat` in `warn_about_fork_with_threads`
Instead, ignore the warnings in all test code that forks. (That's a lot of functions.)
In `test_support`, make `ignore_warnings` a context manager (as well as decorator),
and add a `message` argument to it.
Also add a `ignore_fork_in_thread_deprecation_warnings` helper for the deadlock-in-fork
warning.
Petr Viktorin [Tue, 26 Aug 2025 09:14:35 +0000 (11:14 +0200)]
gh-138143: Allow anonymous unions in public headers, using `_Py_ANONYMOUS` (GH-137283)
We already use an anonymous union for PyObject. This makes the workarounds available in all public headers:
- MSVC: `__pragma(warning(disable: 4201))` (with push/pop). Warning 4201 is specifically for anonymous unions, so let's disable for all of `<Python.h>`
- GCC/clang, pedantic old C standards: define `_Py_ANONYMOUS` as `__extension__`
- otherwise, define `_Py_ANONYMOUS` as nothing
(Note that this is only for public headers -- CPython internals use C11, which has anonymous structs/unions.)
C API WG vote: https://github.com/capi-workgroup/decisions/issues/74
Bénédikt Tran [Sun, 24 Aug 2025 09:01:37 +0000 (11:01 +0200)]
gh-135261: bring back CI job for testing OpenSSL 1.1.1w (#135262)
This partially reverts commit d83e30caddcbf9482273743d287577517ec735b7
by bringing back the CI job for testing OpenSSL 1.1.1w. Despite this
version being upstream EOL, the rationale for keeping it as follows:
- It most resembles other 1.1.1-work-a-like ssl APIs supported by important vendors.
- Python officially requires OpenSSL 1.1.1 or later, although OpenSSL 3.0 or later
is recommended for cryptographic modules. Since changing the build requirements
requires a transition period, we need to keep testing the allowed versions.
- The code base still contains calls to OpenSSL functions that are deprecated since
OpenSSL 3.0 as well as `ifdef` blocks constrained to OpenSSL 1.1.1.
gh-130425: Add "Did you mean [...]" suggestions for `del obj.attr` (GH-136588)
Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Ned Batchelder <ned@nedbatchelder.com> Co-authored-by: Tomas R. <tomas.roun8@gmail.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
gh-137973: Add a non-parallel test plan to the iOS testbed project (#138018)
Modifies the iOS testbed project to add a test plan. This simplifies the iOS
test runner, as we can now use the built-in log streaming to see test results.
It also allows for some other affordances, like providing a default LLDB config,
and using a standardized mechanism for specifying test arguments.
Serhiy Storchaka [Mon, 18 Aug 2025 16:28:56 +0000 (19:28 +0300)]
gh-137044: Make resource.RLIM_INFINITY always positive (GH-137511)
It is now a positive integer larger larger than any limited resource value.
This simplifies comparison of the resource values.
Previously, it could be negative, such as -1 or -3, depending on platform.
Deprecation warning is emitted if the old negative value is passed.
Petr Viktorin [Mon, 18 Aug 2025 12:25:51 +0000 (14:25 +0200)]
gh-135228: Create __dict__ and __weakref__ descriptors for object (GH-136966)
This partially reverts #137047, keeping the tests for GC collectability of the
original class that dataclass adds `__slots__` to.
The reference leaks solved there are instead solved by having the `__dict__` &
`__weakref__` descriptors not tied to (and referencing) their class.
Instead, they're shared between all classes that need them (within
an interpreter).
The `__objclass__` ol the descriptors is set to `object`, since these
descriptors work with *any* object. (The appropriate checks were already
made in the get/set code, so the `__objclass__` check was redundant.)
The repr of these descriptors (and any others whose `__objclass__` is `object`)
now doesn't mention the objclass.
This change required adjustment of introspection code that checks
`__objclass__` to determine an object's “own” (i.e. not inherited) `__dict__`.
Third-party code that does similar introspection of the internals will also
need adjusting.