| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
| |
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
|
| |
|
|
|
|
|
| |
the correct exception handler (GH-137310). (#137427)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
| | |
|
| | |
|
| |
|
|
|
|
| |
(#136971)
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
| |
|
|
|
|
|
| |
(gh-135899) (#136969)
Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
| |
initialization (GH-136583) (GH-136943)
gh-136421: Load `_datetime` static types during interpreter initialization (GH-136583)
`_datetime` is a special module, because it's the only non-builtin C extension that contains static types. As such, it would initialize static types in the module's execution function, which can run concurrently. Since static type initialization is not thread-safe, this caused crashes. This fixes it by moving the initialization of `_datetime`'s static types to interpreter startup (where all other static types are initialized), which is already properly protected through other locks.
(cherry picked from commit a10960699a2b3e4e62896331c4f9cfd162ebf440)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The free threading build uses QSBR to delay the freeing of dictionary
keys and list arrays when the objects are accessed by multiple threads
in order to allow concurrent reads to proceed with holding the object
lock. The requests are processed in batches to reduce execution
overhead, but for large memory blocks this can lead to excess memory
usage.
Take into account the size of the memory block when deciding when to
process QSBR requests.
Also track the amount of memory being held by QSBR for mimalloc pages. Advance the write sequence if this memory exceeds a limit. Advancing the sequence will allow it to be freed more quickly.
Process the held QSBR items from the "eval breaker", rather than from `_PyMem_FreeDelayed()`. This gives a higher chance that the global read sequence has advanced enough so that items can be freed.
(cherry picked from commit 113de8545ffe74a4a1dddb9351fa1cbd3562b621)
Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-136392)
gh-135906: Use `_PyObject_CAST` in internal headers (GH-135892)
Fixes build errors encountered in python-greenlet/greenlet#450 when building greenlet on the free-threaded build.
---------
(cherry picked from commit fe187fae8d8321f1b8d3c9560a35efe904de4217)
Co-authored-by: Charlie Lin <tuug@gmx.us>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
| |
Co-authored-by: Mark Shannon <mark@hotpy.org>
|
| |
|
|
|
|
|
|
|
|
|
| |
(#136206)
gh-127705: Move Py_INCREF_MORTAL() to the internal C API (GH-136178)
Rename Py_INCREF_MORTAL() to _Py_INCREF_MORTAL() and move it to
pycore_object.h internal header.
(cherry picked from commit fa43a1e0f8caf00a15898fa719e31767c866bd90)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-135928) (#136173)
gh-130396: Move PYOS_LOG2_STACK_MARGIN to internal headers (GH-135928)
Move PYOS_LOG2_STACK_MARGIN, PYOS_STACK_MARGIN,
PYOS_STACK_MARGIN_BYTES and PYOS_STACK_MARGIN_SHIFT macros to
pycore_pythonrun.h internal header. Add underscore (_) prefix to the
names to make them private. Rename _PYOS to _PyOS.
(cherry picked from commit 28940e8e4884eb3444a8ea15a5634f76b154d7ed)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
|
|
|
|
| |
3.14 (GH-135921) (GH-135976)
These are private API; let's name new ones accordingly.
(cherry picked from commit 6be17baeb5bcfc78f0b7fcfe5221df0744c865e8)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
extension modules and objects (#135614) (#136119)
gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614)
(cherry picked from commit b1056c2a446b43452e457d5fd5f1bde66afd3883)
Co-authored-by: Xuanteng Huang <44627253+xuantengh@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
|
| |
|
|
|
|
|
|
|
| |
Doc: fix duplicated words (GH-136086)
---------
(cherry picked from commit 698bab5a4031c8f54e04e1dd42bcbe3e4564eba5)
Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
|
| |
|
|
|
| |
(GH-136005) (#136080)
(cherry picked from commit 5334732f9c8a44722e4b339f4bb837b5b0226991)
|
| |
|
|
|
|
|
| |
(GH-135938) (GH-135972)
(cherry picked from commit 10a3d431881bb9169abde97f85ea6a670e1ef3cc)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
struct tag (GH-135924) (GH-135969)
Names/macros defined in public headers should have `Py`/`_Py` prefixes.
(cherry picked from commit a1da208eec3028b1ecae804d4c0dc6b43cdddae9)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
| |
|
|
|
|
| |
(GH-135926)
Macros without a `Py`/`_Py` prefix should not be defined in public headers.
(cherry picked from commit 1b1ae82fab0093924b8b89eb1c7eea11d7be7b18)
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(gh-135593)
For several builtin functions, we now fall back to __main__.__dict__ for the globals
when there is no current frame and _PyInterpreterState_IsRunningMain() returns
true. This allows those functions to be run with Interpreter.call().
The affected builtins:
* exec()
* eval()
* globals()
* locals()
* vars()
* dir()
We take a similar approach with "stateless" functions, which don't use any
global variables.
(cherry picked from commit a450a0ddec, AKA gh-135491)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this refactor we:
* move some code around
* make a couple of typedefs opaque
* decouple errors from session state
* improve tracebacks for propagated exceptions
This change helps simplify several upcoming changes.
(cherry picked from commit c7f4a80079, AKA gh-135369)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
gh-133968: Add PyUnicodeWriter_WriteASCII() function (#133973)
Replace most PyUnicodeWriter_WriteUTF8() calls with
PyUnicodeWriter_WriteASCII().
(cherry picked from commit f49a07b531543dd8a42d90f5b1c89c0312fbf806)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
|
| |
|
|
|
|
|
| |
(#134958) (#135187)
We were incorrectly handling a few opcodes that leave their operands on the stack. Treat all of these conservatively; assume that they always leave operands on the stack.
(cherry picked from commit 6b77af257c25d31f1f137e477cb23e63692ddf29)
|
| |
|
|
|
|
|
|
|
|
| |
gh-134989: Fix Py_RETURN_NONE in the limited C API (GH-135165)
Fix Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE macros in the
limited C API 3.11 and older:
Don't treat Py_None, Py_True and Py_False as immortal.
(cherry picked from commit 9258f3da9175134d03f2c8c7c7eed223802ad945)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
|
|
|
|
| |
API (GH-135021) (#135133)
gh-134989: Implement PyObject_DelAttr() as a macro in the limited C API (GH-135021)
(cherry picked from commit c21113072cd1f0da83729f99d3576647db85d816)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
|
|
|
|
| |
(gh-135053)
gh-134875: Fix mimallc build error for the old compilers (gh-134994)
(cherry picked from commit b525e31b7fc50e7a498f8b9b16437cb7b9656f6f)
Co-authored-by: Donghee Na <donghee.na@python.org>
|
| |
|
|
|
|
|
| |
It now supports most callables, full args, and return values.
(cherry picked from commit 52deabe, AKA gh-133484)
Co-authored-by: Eric Snow ericsnowcurrently@gmail.com
|
| |
|
|
| |
(GH-134725) (#134859)
|
| |\ |
|
| | |
| |
| |
| | |
builds (GH-134682) (#134719)
|
| | | |
|
| |/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#134673)
gh-91048: Refactor and optimize remote debugging module (#134652)
Completely refactor Modules/_remote_debugging_module.c with improved
code organization, replacing scattered reference counting and error
handling with centralized goto error paths. This cleanup improves
maintainability and reduces code duplication throughout the module while
preserving the same external API.
Implement memory page caching optimization in Python/remote_debug.h to
avoid repeated reads of the same memory regions during debugging
operations. The cache stores previously read memory pages and reuses
them for subsequent reads, significantly reducing system calls and
improving performance.
Add code object caching mechanism with a new code_object_generation
field in the interpreter state that tracks when code object caches need
invalidation. This allows efficient reuse of parsed code object metadata
and eliminates redundant processing of the same code objects across
debugging sessions.
Optimize memory operations by replacing multiple individual structure
copies with single bulk reads for the same data structures. This reduces
the number of memory operations and system calls required to gather
debugging information from the target process.
Update Makefile.pre.in to include Python/remote_debug.h in the headers
list, ensuring that changes to the remote debugging header force proper
recompilation of dependent modules and maintain build consistency across
the codebase.
Also, make the module compatible with the free threading build as an extra :)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 42b25ad4d3d6bcdc28ddfe07d2bf8831378bb0d1)
|
| |
|
|
|
|
|
|
|
| |
(#134348)
gh-115999: Add PyCodeObject.co_tlbc to the debug offsets (GH-134286)
(cherry picked from commit dd7f1130570d50461b2a0f81ab01c55b9ce93700)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
(GH-134469) (GH-134547)
GH-130397: remove special-casing of C stack depth for WASI (GH-134469)
Removed special-casing for WASI when setting C stack depth limits. Since WASI has its own C stack checking this isn't a security risk.
Also disabled some tests that stopped passing. They all happened to have already been disabled under Emscripten.
(cherry picked from commit ad42dc1909bdf8ec775b63fb22ed48ff42797a17)
Co-authored-by: Brett Cannon <brett@python.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This is mostly a refactor to clean things up a bit, most notably the "XI namespace" code.
Making the session opaque requires adding the following internal-only functions:
* _PyXI_NewSession()
* _PyXI_FreeSession()
* _PyXI_GetMainNamespace()
(cherry picked from commit 4a4ac3ab4d, gh-134452)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
| |
|
|
|
|
|
| |
_PyCode_VerifyStateless() (gh-134465)
(cherry picked from commit a66bae8bb, AKA gh-134439)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
| |
|
|
|
|
|
|
| |
It now supports a "full" fallback to _PyFunction_GetXIData() and then `_PyPickle_GetXIData()`.
There's also room for other fallback modes if that later makes sense.
(cherry picked from commit 88f8102a8f, AKA gh-133482)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
| |
|
|
|
|
|
|
| |
(GH-134238) (gh-134352)
gh-129748: Update mimalloc to use atomic store for mi_block_set_nextx (GH-134238)
(cherry picked from commit 317c49622397222b7c7fb49837e6b1fd7e82a80d)
Co-authored-by: Donghee Na <donghee.na@python.org>
|
| |
|
|
|
| |
(GH-133860) (#133915)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
|
| |
|
|
|
|
| |
static header. (GH-133966)
Extension builders must specify Py_GIL_DISABLED if they want to link to the free-threaded builds.
This was usually the case already, but this change guarantees it in all circumstances.
|
| |
|
|
|
| |
(#134228)
* gh-128045: Mark unknown opcodes as deopting to themselves (GH-128044)
|
| |
|
|
|
|
|
|
|
|
| |
(#133979)
gh-132641: fix race in `lru_cache` under free-threading (GH-133787)
Fix race in `lru_cache` by acquiring critical section on the cache object itself and call the lock held variant of dict functions to modify the underlying dict.
(cherry picked from commit 9ad0c7b0f14c5fcda6bfae6692c88abb95502d38)
Co-authored-by: Peter Hawkins <phawkins@google.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
error handler (GH-129648) (GH-133942)
If the error handler is used, a new bytes object is created to set as
the object attribute of UnicodeDecodeError, and that bytes object then
replaces the original data. A pointer to the decoded data will became invalid
after destroying that temporary bytes object. So we need other way to return
the first invalid escape from _PyUnicode_DecodeUnicodeEscapeInternal().
_PyBytes_DecodeEscape() does not have such issue, because it does not
use the error handlers registry, but it should be changed for compatibility
with _PyUnicode_DecodeUnicodeEscapeInternal().
(cherry picked from commit 9f69a58623bd01349a18ba0c7a9cb1dad6a51e8e)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
| |
(cherry picked from commit 8cf4947b0f, AKA gh-133481)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|