* Replaces ad-hoc logic for ending traces with a simple inequality: `fitness < exit_quality`
* Fitness starts high and is reduced for branches, backward edges, calls and trace length
* Exit quality reflect how good a spot that instruction is to end a trace. Closing a loop is very, specializable instructions are very low and the others in between.
Add '+' alternatives to signed_number and signed_real_number grammar
rules, mirroring how unary minus is already handled for pattern matching.
Unary plus is a no-op on numbers so the value is returned directly without
wrapping in a UnaryOp node.
Avoid racing with the owning thread's refcount operations when
immortalizing an interned string: if we don't own it and its refcount
isn't merged, intern a copy we own instead. Use atomic stores in
_Py_SetImmortalUntracked so concurrent atomic reads are race-free.
Improve ABI/feature selection, add new header for it.
Add a test that Python headers themselves don't use
Py_GIL_DISABLED in abi3t: abi3 and abi3t ought to be the
same except the _Py_OPAQUE_PYOBJECT differences.
This is done using the GCC-only poison pragma.
Co-authored-by: Victor Stinner <vstinner@python.org>
* Make the `PY_UNWIND` monitoring event available as a code-local
event to allow trapping on function exit events when an exception
bubbles up. This complements the PY_RETURN event by allowing to
catch any function exit event.
* Allow `PY_UNWIND` to be `DISABLE`d; disabling it disables the event for the whole code object.
* Do the above for `PY_THROW`, `RAISE`, `EXCEPTION_HANDLED`, and `RERAISE` events.
`IO` is purported to be the type of the file objects returned by `open`.
However, all methods on those objects take positional-only arguments, while
`IO`'s methods are declared with regular arguments. As such, the file objects
cannot actually be considered to implement `IO`. The same thing applies to
`BinaryIO`.
Fix this by adjusting the definition of these ABCs to match the file objects.
This is technically a breaking change, but it is unlikely to actually break
anything:
* These methods should never be called at runtime, since they are abstract.
Therefore, this should not cause any runtime errors.
* In typeshed these arguments are already positional-only, so this should
not cause any errors during typechecking either.
Forbid marshalling recursive code, slice and frozendict objects which
cannot be correctly unmarshalled.
Reject invalid marshal data produced by marshalling recursive frozendict
objects which was previously incorrectly unmarshalled.
Add multiple tests for recursive data structures.
* Add FOR_ITER_VIRTUAL to specialize FOR_ITER for virtual iterators
* Add GET_ITER_SELF to specialize GET_ITER for iterators (including generators)
* Add GET_ITER_VIRTUAL to specialize GET_ITER for iterables as virtual iterators
* Add new (internal) _tp_iteritem function slot to PyTypeObject
* Put limited RESUME at start of genexpr for free-threading. Fix up exception handling in genexpr
The Modules/_ssl_data_40.h file was created with the commands:
python Tools/ssl/multissltests.py --steps=library --base-directory "$PWD/multissl" --openssl '4.0.0' --system Linux
python Tools/ssl/make_ssl_data.py multissl/src/openssl-4.0.0 Modules/_ssl_data_40.h
Update Modules/_ssl.c to include it on OpenSSL 4.0.0 and newer.
Update test_ssl for the new error message.
Ensure function annotations are returned in order of definition
Previously, when getting type annotations of a function, normal
arguments were returned before positional-only ones in the dictionary.
Since `functools.singledispatch` relies on this ordering being correct
to dispatch based on the type of the first argument, this issue was
causing incorrect registrations for functions with positional-only
arguments.
This commit updates how annotations are generated so that
positional-only arguments are generated and added to the dictionary
before normal arguments.
wave.Wave_write now writes the required RIFF pad byte when the data chunk
size is odd.
Update RIFF chunk size calculations in both header writing and header
patching so they include the alignment pad byte when present.
Add a regression test in test_wave.py that verifies
odd-sized writes are padded, RIFF size is correct, and roundtrip reads
preserve frame data.
The Generator._make_boundary regex did not match on boundary phrases correctly when using CRLF line endings due to re.MULTILINE not considering \r\n as a line ending.
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>