summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-111968: Introduce _PyFreeListState and _PyFreeListState_GET API (gh-113584)Donghee Na2024-01-095-17/+71
|
* Fix opcode name printing in debug mode (#113870)Guido van Rossum2024-01-091-3/+3
| | | Fix a few places where the lltrace debug output printed ``(null)`` instead of an opcode name, because it was calling ``_PyUOpName()`` on a Tier-1 opcode.
* gh-113842: Add missing error check for PyIter_Next() in Python/symtable.c ↵Yan Yanchii2024-01-091-0/+6
| | | | (GH-113843)
* gh-110721: Remove unused code from suggestions.c after moving PyErr_Display ↵Pablo Galindo Salgado2024-01-082-219/+1
| | | | to use the traceback module (#113712)
* gh-73965: Move PYTHON_HISTORY into the correct usage section (#113798)Hugo van Kemenade2024-01-081-1/+1
| | | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-73965: New environment variable PYTHON_HISTORY (#13208)Zackery Spytz2024-01-071-0/+1
| | | | | | | | It can be used to set the location of a .python_history file --------- Co-authored-by: Levi Sabah <0xl3vi@gmail.com> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* gh-107901: synthetic jumps which are not at end of loop no longer check the ↵Irit Katriel2024-01-062-23/+36
| | | | eval breaker (#113721)
* gh-113688: Split up gcmodule.c (gh-113715)Sam Gross2024-01-051-0/+1958
| | | | | This splits part of Modules/gcmodule.c of into Python/gc.c, which now contains the core garbage collection implementation. The Python module remain in the Modules/gcmodule.c file.
* gh-112532: Tag mimalloc heaps and pages (#113742)Sam Gross2024-01-051-2/+2
| | | | | | | | | | | | | | | | | | | | | * gh-112532: Tag mimalloc heaps and pages Mimalloc pages are data structures that contain contiguous allocations of the same block size. Note that they are distinct from operating system pages. Mimalloc pages are contained in segments. When a thread exits, it abandons any segments and contained pages that have live allocations. These segments and pages may be later reclaimed by another thread. To support GC and certain thread-safety guarantees in free-threaded builds, we want pages to only be reclaimed by the corresponding heap in the claimant thread. For example, we want pages containing GC objects to only be claimed by GC heaps. This allows heaps and pages to be tagged with an integer tag that is used to ensure that abandoned pages are only claimed by heaps with the same tag. Heaps can be initialized with a tag (0-15); any page allocated by that heap copies the corresponding tag. * Fix conversion warning
* GH-113486: Do not emit spurious PY_UNWIND events for optimized calls to ↵Mark Shannon2024-01-053-5/+6
| | | | classes. (GH-113680)
* gh-112532: Isolate abandoned segments by interpreter (#113717)Sam Gross2024-01-041-0/+5
| | | | | | | | | | | | | | | * gh-112532: Isolate abandoned segments by interpreter Mimalloc segments are data structures that contain memory allocations along with metadata. Each segment is "owned" by a thread. When a thread exits, it abandons its segments to a global pool to be later reclaimed by other threads. This changes the pool to be per-interpreter instead of process-wide. This will be important for when we use mimalloc to find GC objects in the `--disable-gil` builds. We want heaps to only store Python objects from a single interpreter. Absent this change, the abandoning and reclaiming process could break this isolation. * Add missing '&_mi_abandoned_default' to 'tld_empty'
* GH-113689: Fix broken handling of invalid executors (GH-113694)Brandt Bucher2024-01-042-2/+4
|
* gh-113603: Compiler no longer tries to maintain the no-empty-block invariant ↵Irit Katriel2024-01-031-78/+38
| | | | (#113636)
* GH-113595: Don't enter invalid executor (GH-113596)Mark Shannon2024-01-032-19/+39
|
* GH-113657: Add back missing _SET_IP uops in tier two (GH-113662)Brandt Bucher2024-01-021-2/+3
|
* gh-73427: deprecate `_enablelegacywindowsfsencoding` (#107729)Inada Naoki2023-12-281-0/+7
|
* gh-112532: Use separate mimalloc heaps for GC objects (gh-113263)Sam Gross2023-12-262-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | * gh-112532: Use separate mimalloc heaps for GC objects In `--disable-gil` builds, we now use four separate heaps in anticipation of using mimalloc to find GC objects when the GIL is disabled. To support this, we also make a few changes to mimalloc: * `mi_heap_t` and `mi_tld_t` initialization is split from allocation. This allows us to have a `mi_tld_t` per-`PyThreadState`, which is important to keep interpreter isolation, since the same OS thread may run in multiple interpreters (using different PyThreadStates.) * Heap abandoning (mi_heap_collect_ex) can now be called from a different thread than the one that created the heap. This is necessary because we may clear and delete the containing PyThreadStates from a different thread during finalization and after fork(). * Use enum instead of defines and guard mimalloc includes. * The enum typedef will be convenient for future PRs that use the type. * Guarding the mimalloc includes allows us to unconditionally include pycore_mimalloc.h from other header files that rely on things like `struct _mimalloc_thread_state`. * Only define _mimalloc_thread_state in Py_GIL_DISABLED builds
* gh-106905: Use separate structs to track recursion depth in each ↵Yilei Yang2023-12-251-312/+377
| | | | | | PyAST_mod2obj call. (GH-113035) Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
* GH-111485: Fix handling of FOR_ITER in Tier 2 (GH-113394)Mark Shannon2023-12-241-12/+5
|
* gh-113297: Fix segfault in compiler for with statement with 19 context ↵Irit Katriel2023-12-221-1/+2
| | | | managers (#113327)
* gh-113343: Fix error check on mmap(2) (#113342)Namhyung Kim2023-12-211-1/+1
| | | | | | | | | | | | Fix error check on mmap(2) It should check MAP_FAILED instead of NULL for error. On mmap(2) man page: RETURN VALUE On success, mmap() returns a pointer to the mapped area. On error, the value MAP_FAILED (that is, (void *) -1) is returned, and errno is set to indicate the error.
* GH-111485: Delete the old generator code. (GH-113321)Mark Shannon2023-12-213-1019/+52
|
* gh-111375: Use `NULL` rather than `None` in the exception stack to indicate ↵Carey Metcalfe2023-12-214-6/+6
| | | | that an exception was handled (#113302)
* GH-111485: Generate `TARGET` table for computed goto dispatch. (GH-113319)Mark Shannon2023-12-201-1/+2
|
* GH-111485: Generate instruction and uop metadata (GH-113287)Mark Shannon2023-12-208-83/+93
|
* gh-113054: Compiler no longer replaces a redundant jump with no line number ↵Irit Katriel2023-12-191-1/+16
| | | | by a NOP (#113139)
* gh-112535: Implement fallback implementation of _Py_ThreadId() (gh-113185)Donghee Na2023-12-181-0/+14
| | | | | --------- Co-authored-by: Sam Gross <colesbury@gmail.com>
* GH-111485: Break up instructions with unused cache entries into component ↵Mark Shannon2023-12-181-0/+71
| | | | micro-ops (GH-113169)
* GH-111485: Test the new cases generator (GH-113252)Mark Shannon2023-12-182-28/+28
|
* gh-111964: Add _PyRWMutex a "readers-writer" lock (gh-112859)Sam Gross2023-12-161-0/+106
| | | | This adds `_PyRWMutex`, a "readers-writer" lock, which wil be used to serialize global stop-the-world pauses with per-interpreter pauses.
* GH-111485: Mark some instructions as `TIER_ONE_ONLY` (GH-113155)Brandt Bucher2023-12-153-139/+14
|
* GH-112354: Treat _EXIT_TRACE like an unconditional side exit (GH-113104)Mark Shannon2023-12-144-21/+4
|
* gh-112716: Fix SystemError when __builtins__ is not a dict (GH-112770)Serhiy Storchaka2023-12-141-2/+2
| | | | | | It was raised in two cases: * in the import statement when looking up __import__ * in pickling some builtin type when looking up built-ins iter, getattr, etc.
* Fix whitespace in generated codeMark Shannon2023-12-131-6/+6
|
* gh-76785: Avoid Pickled TracebackException for Propagated Subinterpreter ↵Eric Snow2023-12-131-151/+88
| | | | | Exceptions (gh-113036) We need the TracebackException of uncaught exceptions for a single purpose: the error display. Thus we only need to pass the formatted error display between interpreters. Passing a pickled TracebackException is overkill.
* gh-112723: Call `PyThreadState_Clear()` from the correct interpreter (#112776)Sam Gross2023-12-133-53/+30
| | | | | | | | | | | | | The `PyThreadState_Clear()` function must only be called with the GIL held and must be called from the same interpreter as the passed in thread state. Otherwise, any Python objects on the thread state may be destroyed using the wrong interpreter, leading to memory corruption. This is also important for `Py_GIL_DISABLED` builds because free lists will be associated with PyThreadStates and cleared in `PyThreadState_Clear()`. This fixes two places that called `PyThreadState_Clear()` from the wrong interpreter and adds an assertion to `PyThreadState_Clear()`.
* gh-76785: Show the Traceback for Uncaught Subinterpreter Exceptions (gh-113034)Eric Snow2023-12-131-12/+206
| | | When an exception is uncaught in Interpreter.exec_sync(), it helps to show that exception's error display if uncaught in the calling interpreter. We do so here by generating a TracebackException in the subinterpreter and passing it between interpreters using pickle.
* gh-112320: Implement on-trace confidence tracking for branches (#112321)Guido van Rossum2023-12-122-3/+18
| | | We track the confidence as a scaled int.
* gh-113010: Don't decrement deferred in pystats (#113032)Michael Droettboom2023-12-121-4/+0
| | | This fixes a recently introduced bug where the deferred count is being unnecessarily decremented to counteract an increment elsewhere that is no longer happening. This caused the values to flip around to "very large" 64-bit numbers.
* GH-108866: Guarantee forward progress in executors. (GH-113006)Mark Shannon2023-12-123-18/+13
|
* gh-76785: Fixes for test.support.interpreters (gh-112982)Eric Snow2023-12-123-1/+69
| | | This involves a number of changes for PEP 734.
* GH-111485: Factor out tier 2 code generation from the rest of the ↵Mark Shannon2023-12-123-731/+893
| | | | interpreter code generator (GH-112968)
* gh-112970: Detect and use closefrom() when available (#112969)Sam James2023-12-121-3/+3
| | | | | | | | | | | glibc-2.34 implements closefrom(3) using the same semantics as on BSD. Check for closefrom() in configure and use the check result in fileutils.c, rather than hardcoding a FreeBSD check. Some implementations of closefrom() return an int. Explicitly discard the return value by casting it to void, to avoid future compiler warnings. Signed-off-by: Sam James <sam@gentoo.org>
* A smattering of cleanups in uop debug output and lltrace (#112980)Guido van Rossum2023-12-123-10/+11
| | | | | | * Include destination T1 opcode in Error debug message * Include destination T1 opcode in DEOPT debug message * Remove obsolete comment from remove_unneeded_uops * Change lltrace_instruction() to print caller's opcode/oparg
* gh-112978: Remove redundant condition inside `take_gil` (gh-112979)Yan Yanchii2023-12-111-5/+0
|
* gh-90350: Optimize builtin functions min() and max() (GH-30286)colorfulappl2023-12-111-36/+45
| | | | Builtin functions min() and max() now use METH_FASTCALL
* gh-112943: Correctly compute end offsets for multiline tokens in the ↵Pablo Galindo Salgado2023-12-111-1/+1
| | | | tokenize module (#112949)
* gh-111924: Use PyMutex for Runtime-global Locks. (gh-112207)Sam Gross2023-12-076-182/+41
| | | | | This replaces some usages of PyThread_type_lock with PyMutex, which does not require memory allocation to initialize. This simplifies some of the runtime initialization and is also one step towards avoiding changing the default raw memory allocator during initialize/finalization, which can be non-thread-safe in some circumstances.
* gh-112538: Add internal-only _PyThreadStateImpl "wrapper" for PyThreadState ↵Sam Gross2023-12-071-14/+14
| | | | | | | | (gh-112560) Every PyThreadState instance is now actually a _PyThreadStateImpl. It is safe to cast from `PyThreadState*` to `_PyThreadStateImpl*` and back. The _PyThreadStateImpl will contain fields that we do not want to expose in the public C API.
* gh-111962: Make dtoa thread-safe in `--disable-gil` builds. (#112049)Sam Gross2023-12-072-25/+59
| | | | | | | | | | | | | | | | | | | | This updates `dtoa.c` to avoid using the Bigint free-list in --disable-gil builds and to pre-computes the needed powers of 5 during interpreter initialization. * gh-111962: Make dtoa thread-safe in `--disable-gil` builds. This avoids using the Bigint free-list in `--disable-gil` builds and pre-computes the needed powers of 5 during interpreter initialization. * Fix size of cached powers of 5 array. We need the powers of 5 up to 5**512 because we only jump straight to underflow when the exponent is less than -512 (or larger than 308). * Rename Py_NOGIL to Py_GIL_DISABLED * Changes from review * Fix assertion placement