aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python
Commit message (Collapse)AuthorAge
* gh-125541: Make Ctrl-C interrupt `threading.Lock.acquire()` on Windows (#125546)Sam Gross2024-10-17
|
* gh-123153: Fix PGO builds with free-threading on Windows (#125607)Michael Droettboom2024-10-17
| | | | | * gh-123153: Fix PGO builds with free-threading * Redo how the #define works
* gh-125217: Turn off optimization around_PyEval_EvalFrameDefault to avoid ↵Michael Droettboom2024-10-16
| | | | MSVC crash (#125477)
* gh-124872: Replace enter/exit events with "switched" (#125532)Kirill Podoprigora2024-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | Users want to know when the current context switches to a different context object. Right now this happens when and only when a context is entered or exited, so the enter and exit events are synonymous with "switched". However, if the changes proposed for gh-99633 are implemented, the current context will also switch for reasons other than context enter or exit. Since users actually care about context switches and not enter or exit, replace the enter and exit events with a single switched event. The former exit event was emitted just before exiting the context. The new switched event is emitted after the context is exited to match the semantics users expect of an event with a past-tense name. If users need the ability to clean up before the switch takes effect, another event type can be added in the future. It is not added here because YAGNI. I skipped 0 in the enum as a matter of practice. Skipping 0 makes it easier to troubleshoot when code forgets to set zeroed memory, and it aligns with best practices for other tools (e.g., https://protobuf.dev/programming-guides/dos-donts/#unspecified-enum). Co-authored-by: Richard Hansen <rhansen@rhansen.org> Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-124218: Use per-thread refcounts for code objects (#125216)Sam Gross2024-10-15
| | | | | | | Use per-thread refcounting for the reference from function objects to their corresponding code object. This can be a source of contention when frequently creating nested functions. Deferred refcounting alone isn't a great fit here because these references are on the heap and may be modified by other libraries.
* gh-124375: Avoid calling `_PyMem_ProcessDelayed` on other thread states ↵Sam Gross2024-10-15
| | | | | | | | | | | (#124459) This fixes a crash when running the PyO3 test suite on the free-threaded build. The `qsbr` field is initialized after the `PyThreadState` is added to the interpreter's linked list -- it might still be NULL. Instead, we "steal" the queue of to-be-freed memory blocks. This is always initialized (possibly empty) and protected by the stop the world pause.
* gh-125512: Revert "gh-124872: Replace enter/exit events with "switched" ↵Kirill Podoprigora2024-10-15
| | | | (#124776)" (#125513)
* gh-125196: Use PyUnicodeWriter in HAMT (#125458)Victor Stinner2024-10-15
|
* gh-125234: Make PyInitConfig_Free(NULL) a no-op (#125266)RUANG (Roy James)2024-10-15
|
* gh-125470: Fix warning in `Python/generated_cases.c.h` (#125471)sobolevn2024-10-14
| | | Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* gh-124872: Replace enter/exit events with "switched" (#124776)Richard Hansen2024-10-14
| | | | | | | | | | | | | | | | | | | | | | Users want to know when the current context switches to a different context object. Right now this happens when and only when a context is entered or exited, so the enter and exit events are synonymous with "switched". However, if the changes proposed for gh-99633 are implemented, the current context will also switch for reasons other than context enter or exit. Since users actually care about context switches and not enter or exit, replace the enter and exit events with a single switched event. The former exit event was emitted just before exiting the context. The new switched event is emitted after the context is exited to match the semantics users expect of an event with a past-tense name. If users need the ability to clean up before the switch takes effect, another event type can be added in the future. It is not added here because YAGNI. I skipped 0 in the enum as a matter of practice. Skipping 0 makes it easier to troubleshoot when code forgets to set zeroed memory, and it aligns with best practices for other tools (e.g., https://protobuf.dev/programming-guides/dos-donts/#unspecified-enum).
* GH-125323: Convert DECREF_INPUTS_AND_REUSE_FLOAT into a function that takes ↵Mark Shannon2024-10-14
| | | | PyStackRefs. (GH-125439)
* gh-125139: use `_PyRecursiveMutex` in `_thread.RLock` (#125144)Kumar Aditya2024-10-14
|
* gh-125323: Remove some unsafe Py_DECREFs in bytecodes.c, replacing them with ↵Ken Jin2024-10-14
| | | | PyStackRef_CLOSEs (GH-125324)
* gh-125161: return non zero value in pthread_self on wasi (#125303)Kumar Aditya2024-10-13
|
* gh-124872: Change PyContext_WatchCallback to take PyObject (#124737)Richard Hansen2024-10-12
| | | | | The PyContext struct is not intended to be public, and users of the API don't need anything more specific than PyObject. Also see gh-78943.
* gh-124872: Move PyThreadState to first argument for consistency (#124774)Richard Hansen2024-10-12
|
* gh-111924: use atomics for interp id refcounting (#125321)Kumar Aditya2024-10-12
|
* gh-125268: Use static string for "1e309" in AST (#125272)Sam Gross2024-10-10
| | | | | When formatting the AST as a string, infinite values are replaced by 1e309, which evaluates to infinity. The initialization of this string replacement was not thread-safe in the free threading build.
* GH-125174: Make immortal objects more robust, following design from PEP 683 ↵Mark Shannon2024-10-10
| | | | (GH-125251)
* gh-125196: Use PyUnicodeWriter for repr(contextvars.Token) (#125220)Victor Stinner2024-10-09
| | | Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.
* gh-125196: Use PyUnicodeWriter in symtable.c (#125199)Victor Stinner2024-10-09
|
* gh-115999: Refactor `LOAD_GLOBAL` specializations to avoid reloading ↵mpage2024-10-09
| | | | | | | | | | | | | | | | | | {globals, builtins} keys (gh-124953) Each of the `LOAD_GLOBAL` specializations is implemented roughly as: 1. Load keys version. 2. Load cached keys version. 3. Deopt if (1) and (2) don't match. 4. Load keys. 5. Load cached index into keys. 6. Load object from (4) at offset from (5). This is not thread-safe in free-threaded builds; the keys object may be replaced in between steps (3) and (4). This change refactors the specializations to avoid reloading the keys object and instead pass the keys object from guards to be consumed by downstream uops.
* gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) (#125194)Victor Stinner2024-10-09
| | | | | Replace PyUnicode_New(0, 0), PyUnicode_FromString("") and PyUnicode_FromStringAndSize("", 0) with Py_GetConstant(Py_CONSTANT_EMPTY_STR).
* gh-125039: Make `this_instr`/`prev_instr` const in cases generator (GH-125071)Tomas R.2024-10-09
|
* gh-124502: Remove _PyUnicode_EQ() function (#125114)Victor Stinner2024-10-09
| | | | | | * Replace unicode_compare_eq() with unicode_eq(). * Use unicode_eq() in setobject.c. * Replace _PyUnicode_EQ() with _PyUnicode_Equal(). * Remove unicode_compare_eq() and _PyUnicode_EQ().
* gh-125063: Emit slices as constants in the bytecode compiler (#125064)Michael Droettboom2024-10-08
| | | | | | | | | | | | | | | | | | | | | | | * Make slices marshallable * Emit slices as constants * Update Python/marshal.c Co-authored-by: Peter Bierma <zintensitydev@gmail.com> * Refactor codegen_slice into two functions so it always has the same net effect * Fix for free-threaded builds * Simplify marshal loading of slices * Only return SUCCESS/ERROR from codegen_slice --------- Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* gh-115999: Stop the world when invalidating function versions (#124997)mpage2024-10-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stop the world when invalidating function versions The tier1 interpreter specializes `CALL` instructions based on the values of certain function attributes (e.g. `__code__`, `__defaults__`). The tier1 interpreter uses function versions to verify that the attributes of a function during execution of a specialization match those seen during specialization. A function's version is initialized in `MAKE_FUNCTION` and is invalidated when any of the critical function attributes are changed. The tier1 interpreter stores the function version in the inline cache during specialization. A guard is used by the specialized instruction to verify that the version of the function on the operand stack matches the cached version (and therefore has all of the expected attributes). It is assumed that once the guard passes, all attributes will remain unchanged while executing the rest of the specialized instruction. Stopping the world when invalidating function versions ensures that all critical function attributes will remain unchanged after the function version guard passes in free-threaded builds. It's important to note that this is only true if the remainder of the specialized instruction does not enter and exit a stop-the-world point. We will stop the world the first time any of the following function attributes are mutated: - defaults - vectorcall - kwdefaults - closure - code This should happen rarely and only happens once per function, so the performance impact on majority of code should be minimal. Additionally, refactor the API for manipulating function versions to more clearly match the stated semantics.
* gh-121404: typo fix in compile.c: MATADATA -> METADATA (#125101)Mikhail Efimov2024-10-08
|
* GH-121459: Streamline PyObject* to PyStackRef conversions by disallowing ↵Mark Shannon2024-10-07
| | | | NULL pointers. (GH-124894)
* GH-119866: Spill the stack around escaping calls. (GH-124392)Mark Shannon2024-10-07
| | | | | | | * Spill the evaluation around escaping calls in the generated interpreter and JIT. * The code generator tracks live, cached values so they can be saved to memory when needed. * Spills the stack pointer around escaping calls, so that the exact stack is visible to the cycle GC.
* GH-116968: Remove branch from advance_backoff_counter (GH-124469)Mark Shannon2024-10-07
|
* gh-125010: Fix `use-after-free` in AST `repr()` (#125015)Tomas R.2024-10-06
|
* gh-112804: Clamping timeout value for _PySemaphore_PlatformWait (gh-124914)Donghee Na2024-10-05
| | | | | | | * gh-112804: Clamping timeout value for _PySemaphore_PlatformWait * Address code review * nit
* gh-124871: fix 'visited' tracking in compiler's reachability analysis (#124952)Irit Katriel2024-10-04
|
* gh-111178: Fix function signatures in Python-ast.c (#124942)Victor Stinner2024-10-04
|
* GH-118093: Don't lose confidence when tracing through 100% biased branches ↵Brandt Bucher2024-10-02
| | | | (GH-124813)
* GH-119726: Deduplicate AArch64 trampolines within a trace (GH-123872)Diego Russo2024-10-02
|
* gh-120619: Optimize through `_Py_FRAME_GENERAL` (GH-124518)Ken Jin2024-10-03
| | | | | * Optimize through _Py_FRAME_GENERAL * refactor
* gh-87135: Hang non-main threads that attempt to acquire the GIL during ↵Jeremy Maitin-Shepard2024-10-02
| | | | | | | finalization (GH-105805) Instead of surprise crashes and memory corruption, we now hang threads that attempt to re-enter the Python interpreter after Python runtime finalization has started. These are typically daemon threads (our long standing mis-feature) but could also be threads spawned by extension modules that then try to call into Python. This marks the `PyThread_exit_thread` public C API as deprecated as there is no plausible safe way to accomplish that on any supported platform in the face of things like C++ code with finalizers anywhere on a thread's stack. Doing this was the least bad option. Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-116750: Add clear_tool_id function to unregister events and callbacks ↵Tian Gao2024-10-01
| | | | (#124568)
* gh-124218: Refactor per-thread reference counting (#124844)Sam Gross2024-10-01
| | | | | | | Currently, we only use per-thread reference counting for heap type objects and the naming reflects that. We will extend it to a few additional types in an upcoming change to avoid scaling bottlenecks when creating nested functions. Rename some of the files and functions in preparation for this change.
* gh-124296: Remove private dictionary version tag (PEP 699) (#124472)Sam Gross2024-10-01
|
* gh-123497: New limit for Python integers on 64-bit platforms (GH-123724)Serhiy Storchaka2024-09-29
| | | | | | | | | | | Instead of be limited just by the size of addressable memory (2**63 bytes), Python integers are now also limited by the number of bits, so the number of bit now always fit in a 64-bit integer. Both limits are much larger than what might be available in practice, so it doesn't affect users. _PyLong_NumBits() and _PyLong_Frexp() are now always successful.
* gh-124665: Add `_PyCodec_UnregisterError` and `_codecs._unregister_error` ↵Bénédikt Tran2024-09-29
| | | | (#124677)
* gh-124442: make `__static_attributes__` deterministic by sorting (#124492)Kira2024-09-28
| | | | | Signed-off-by: kp2pml30 <kp2pml30@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* gh-107954: Fix configuration type for the perf profiler (#124636)Pablo Galindo Salgado2024-09-28
|
* gh-119180: No longer set `__annotations__` in `__main__` (#124634)Jelle Zijlstra2024-09-27
|
* gh-116510: Fix crash during sub-interpreter shutdown (gh-124645)Neil Schemenauer2024-09-26
| | | | | Fix a bug that can cause a crash when sub-interpreters use "basic" single-phase extension modules. Shared objects could refer to PyGC_Head nodes that had been freed as part of interpreter shutdown.
* GH-123516: Improve JIT memory consumption by invalidating cold executors ↵Savannah Ostrowski2024-09-27
| | | | | (GH-124443) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>