summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-124502: Remove _PyUnicode_EQ() function (#125114)Victor Stinner2024-10-091-1/+1
| | | | | | * 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-082-19/+93
| | | | | | | | | | | | | | | | | | | | | | | * 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-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-081-5/+5
|
* GH-121459: Streamline PyObject* to PyStackRef conversions by disallowing ↵Mark Shannon2024-10-073-52/+54
| | | | NULL pointers. (GH-124894)
* GH-119866: Spill the stack around escaping calls. (GH-124392)Mark Shannon2024-10-078-1406/+2356
| | | | | | | * 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-073-8/+8
|
* gh-125010: Fix `use-after-free` in AST `repr()` (#125015)Tomas R.2024-10-061-1/+0
|
* gh-112804: Clamping timeout value for _PySemaphore_PlatformWait (gh-124914)Donghee Na2024-10-051-1/+8
| | | | | | | * 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-041-2/+3
|
* gh-111178: Fix function signatures in Python-ast.c (#124942)Victor Stinner2024-10-041-7/+11
|
* GH-118093: Don't lose confidence when tracing through 100% biased branches ↵Brandt Bucher2024-10-021-4/+2
| | | | (GH-124813)
* GH-119726: Deduplicate AArch64 trampolines within a trace (GH-123872)Diego Russo2024-10-021-8/+84
|
* gh-120619: Optimize through `_Py_FRAME_GENERAL` (GH-124518)Ken Jin2024-10-023-47/+54
| | | | | * Optimize through _Py_FRAME_GENERAL * refactor
* gh-87135: Hang non-main threads that attempt to acquire the GIL during ↵Jeremy Maitin-Shepard2024-10-024-12/+39
| | | | | | | 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-013-1/+113
| | | | (#124568)
* gh-124218: Refactor per-thread reference counting (#124844)Sam Gross2024-10-014-68/+72
| | | | | | | 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-014-11/+5
|
* gh-123497: New limit for Python integers on 64-bit platforms (GH-123724)Serhiy Storchaka2024-09-291-11/+12
| | | | | | | | | | | 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-291-0/+22
| | | | (#124677)
* gh-124442: make `__static_attributes__` deterministic by sorting (#124492)Kira2024-09-281-1/+11
| | | | | 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-271-1/+1
|
* gh-119180: No longer set `__annotations__` in `__main__` (#124634)Jelle Zijlstra2024-09-271-7/+1
|
* gh-116510: Fix crash during sub-interpreter shutdown (gh-124645)Neil Schemenauer2024-09-271-3/+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-276-0/+70
| | | | | (GH-124443) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-119333: get interp from tstate for PyContext watchers(#124444)Jason Fried2024-09-261-4/+4
| | | Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-117376: Fix off-by-ones in conversion functions (GH-124301)Ken Jin2024-09-253-6/+6
| | | Fix off-by-ones in conversion function
* gh-124285: Fix bug where bool() is called multiple times for the same part ↵Irit Katriel2024-09-253-6/+81
| | | | of a boolean expression (#124394)
* gh-123923: Defer refcounting for `f_funcobj` in `_PyInterpreterFrame` (#124026)Sam Gross2024-09-249-111/+87
| | | | | | Use a `_PyStackRef` and defer the reference to `f_funcobj` when possible. This avoids some reference count contention in the common case of executing the same code object from multiple threads concurrently in the free-threaded build.
* gh-124188: Fix PyErr_ProgramTextObject() (GH-124189)Serhiy Storchaka2024-09-241-35/+56
| | | | | | | | * Detect source file encoding. * Use the "replace" error handler even for UTF-8 (default) encoding. * Remove the BOM. * Fix detection of too long lines if they contain NUL. * Return the head rather than the tail for truncated long lines.
* gh-119333: Add C api to have contextvar enter/exit callbacks (#119335)Jason Fried2024-09-242-0/+81
| | | Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* GH-124284: Add stats for refcount operations on immortal objects (GH-124288)Mark Shannon2024-09-232-4/+11
|
* gh-111513: Improve datetime.fromtimestamp's error message (#124249)AN Long2024-09-201-0/+4
|
* gh-123880: Allow recursive import of single-phase-init modules (GH-123950)Petr Viktorin2024-09-201-5/+13
| | | | Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Co-authored-by: Brett Cannon <brett@python.org>
* gh-124160: Pass main_tstate to update_global_state_for_extension() (#124164)luk13372024-09-191-1/+1
|
* gh-116022: Improve `repr()` of AST nodes (#117046)Tomas R2024-09-181-0/+222
| | | | | | Co-authored-by: AN Long <aisk@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-123969: refactor _PyErr_RaiseSyntaxError and _PyErr_EmitSyntaxWarning out ↵Irit Katriel2024-09-162-30/+53
| | | | of compiler (#123972)
* gh-124058: remove _PyCompile_IsNestedScope, roll it into ↵Irit Katriel2024-09-162-11/+5
| | | | _PyCompile_IsInteractive (#124061)
* gh-124068: Fix reference leak with generators in the free-threaded build ↵Sam Gross2024-09-141-0/+13
| | | | | | | (#124069) If the generator is already cleared, then most fields in the generator's frame are not valid other than f_executable. The invalid fields may contain dangling pointers and should not be used.
* gh-121459: Deferred LOAD_GLOBAL (GH-123128)Ken Jin2024-09-135-28/+30
| | | | Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Sam Gross <655866+colesbury@users.noreply.github.com>
* gh-124022: Fix bug where class docstring is removed in interactive mode ↵Irit Katriel2024-09-132-5/+5
| | | | | | | (#124023) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-124019: do not call codegen_annotations_in_scope if there are no ↵Irit Katriel2024-09-121-14/+10
| | | | annotations (#124020)
* gh-124013: remove _PyCompile_IsTopLevelAwait (#124014)Irit Katriel2024-09-122-25/+0
|
* gh-123923: Defer refcounting for `f_executable` in `_PyInterpreterFrame` ↵Sam Gross2024-09-129-76/+102
| | | | | | | | (#123924) Use a `_PyStackRef` and defer the reference to `f_executable` when possible. This avoids some reference count contention in the common case of executing the same code object from multiple threads concurrently in the free-threaded build.
* GH-123996: Explicitly mark 'self_or_null' as an array of size 1 to ensure ↵Mark Shannon2024-09-124-322/+291
| | | | that it is kept in memory for calls (GH-124003)
* gh-123958: apply docstring removal optimization in ast_opt instead of ↵Irit Katriel2024-09-112-22/+37
| | | | codegen (#123959)
* gh-123881: make compiler add the .generic_base base class without ↵Irit Katriel2024-09-102-46/+52
| | | | | | constructing AST nodes (#123883)
* gh-122239: Add actual count in unbalanced unpacking error message when ↵Tushar Sadhwani2024-09-101-0/+11
| | | | possible (#122244)
* gh-123892: Add "_wmi" to sys.stdlib_module_names (#123893)Victor Stinner2024-09-101-0/+1
|
* gh-121404: split compile.c into compile.c and codegen.c (#123651)Irit Katriel2024-09-093-6644/+6521
|