getpagesize() is not an ISO C or POSIX function. Darwin hides the prototype under -std=c11, so the _remote_debugging build fails with -Werror=implicit-function-declaration. That is the failure in the reported x86_64-apple-darwin → arm64-apple-darwin cross build.
Call sysconf(_SC_PAGESIZE) instead, which is already how resource.getpagesize() works. Fall back to 4096 if sysconf() fails.
--without-remote-debug is unchanged. That flag only disables the target-side attach protocol (Py_REMOTE_DEBUG); it does not exclude the _remote_debugging client module.
The value of a @setter is now a parameter, which can use a converter,
and a @getter can define a return converter. Declaring the value is
optional.
The accessors of an attribute are now collected in a Property, so the
entry of PyGetSetDef is identified by the Python name instead of the C
basename, and is composed without the help of the preprocessor unless
some accessor is compiled conditionally.
Previously the marshal writer recorded an error code and converted it into
an exception at the end, replacing the exception which was already raised
with ValueError("unmarshallable object"). Error messages now name the type
of the unsupported object and the required version.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
It was the ANSI code page instead of the encoding of the device the stream
is connected to, as in 3.7.
The stdio encoding is now left undefined in this mode and determined for
every standard stream.
Replace soft deprecated PyBytes_FromStringAndSize() with
PyBytesWriter.
Replace also PyBytes_FromStringAndSize(NULL, 0) with
Py_GetConstant(Py_CONSTANT_EMPTY_BYTES) in other functions.
Replace also PyBytes_FromStringAndSize(NULL, 0) with
PyBytes_FromStringAndSize("", 0) in _Py_GetConstant_Init().
Use free() instead of PyMem_RawFree() in pythread_wrapper() to avoid
a data race if another thread calls PyMem_SetAllocator() in parallel.
Reenable @nomemtest tests on TSAN.
Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
In debug mode at Python exit, check if immutable singleton objects
have been modified by mistake to detect bugs in C extensions.
Add tests corrupting bytes, str, bool and int singleton objects.
Add pycore_global_objects_fini.h internal header file.
pycore_global_objects_fini_generated.h is now fully generated by the
script.
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Make pegen and _tokenize consume tokenizer operations instead of accessing the tokenizer layout. Return token kind, span, location, and raw-string context together, so parser actions use the context of the cached token.
Represent persistent scanner positions as offsets and remove pointer save/restore bookkeeping when input storage grows.
The trampoline exports _PyRuntime's address itself and reuses a
placeholder's table slot, so libpython no longer needs
-sEXPORTED_FUNCTIONS=__PyRuntime or a growable function table.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Formatted-string expressions and comments can outlive the buffer window where
scanning began. Pointer boundaries require buffer relocation to repair tokenizer
state. Record logical source ranges instead. Retain the active input window while a
formatted string is open, give each mode ownership of its comment spans, and
materialize text through shared span views.
Represent token boundaries as logical source offsets with explicit start
and end locations, and adapt pegen and _tokenize to consume them.
Use SourceText to own decoded input across all reader modes. Streaming
readers discard consumed windows while preserving logical offsets and
reusing the allocation. Prepared and interactive input retain their source.
Force source relocation on growth in debug builds and add coverage for
formatted-string growth, interactive input, storage reuse, and offset
limits. Scanner positions remain pointers, rebased when storage moves.
Functions reading marshalled data from a FILE* now raise OSError for I/O
errors and KeyboardInterrupt for interrupted reading, instead of EOFError.
PyMarshal_WriteObjectToFile() and PyMarshal_WriteLongToFile() now detect
I/O errors and interrupted writing instead of ignoring them.
PyMarshal_WriteObjectToFile() now also sets the error indicator if the
value cannot be marshalled.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
The iteration stops when the callable raises the specified exception (an
exception class or a tuple of exception classes). It is keyword-only and
can be used without the stop value. The second parameter of iter() is now
named stop_value and can be passed as a keyword argument.
aiter() now accepts the same parameters, which it never had before: the
callable is called and its result is awaited for every __anext__().
If the callable raises StopIteration (StopAsyncIteration in aiter()) which
does not match stop_exception, it is replaced with RuntimeError, as PEP 479
and PEP 525 do for generators.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
In the legacy Windows stdio mode PyConfig.stdio_encoding is now initialized
with the console output code page instead of the ANSI code page.
Only one encoding can be specified, so sys.stdin.encoding is still wrong if
the input code page differs from the output one.
It was hard coded to map file descriptors 0, 1 and 2 to the console code
page, but a console can be opened as any file descriptor, and other
character devices, like NUL, are not consoles.
The file handle is now queried. The UTF-8 code page is also now reported
as "utf-8" instead of "cp65001".
Also fix a crash when unmarshalling a self-referencing tuple.
Co-authored-by: Michael Bommarito <michael.bommarito@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>