summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-115999: Add partial free-thread specialization for BINARY_SUBSCR (gh-127227)Donghee Na2024-12-024-18/+40
|
* gh-127165: Disallow embedded NULL characters in `_interpreters` (#127199)Peter Bierma2024-12-011-0/+5
|
* gh-127208: Reject null character in _imp.create_dynamic() (#127400)Victor Stinner2024-11-291-3/+5
| | | | _imp.create_dynamic() now rejects embedded null characters in the path and in the module name.
* gh-126881: fix finalization of dtoa state (#126904)Kumar Aditya2024-11-291-1/+3
|
* gh-123967: Fix faulthandler for trampoline frames (#127329)Victor Stinner2024-11-271-9/+14
| | | If the top-most frame is a trampoline frame, skip it.
* gh-115999: Add free-threaded specialization for `STORE_SUBSCR` (#127169)Sam Gross2024-11-265-70/+109
| | | | | | | | | The specialization only depends on the type, so no special thread-safety considerations there. STORE_SUBSCR_LIST_INT needs to lock the list before modifying it. `_PyDict_SetItem_Take2` already internally locks the dictionary using a critical section.
* gh-69639: Add mixed-mode rules for complex arithmetic (C-like) (GH-124829)Sergey B Kirpichev2024-11-261-2/+0
| | | | | | | | | | | | | | | "Generally, mixed-mode arithmetic combining real and complex variables should be performed directly, not by first coercing the real to complex, lest the sign of zero be rendered uninformative; the same goes for combinations of pure imaginary quantities with complex variables." (c) Kahan, W: Branch cuts for complex elementary functions. This patch implements mixed-mode arithmetic rules, combining real and complex variables as specified by C standards since C99 (in particular, there is no special version for the true division with real lhs operand). Most C compilers implementing C99+ Annex G have only these special rules (without support for imaginary type, which is going to be deprecated in C2y).
* gh-119180: Add VALUE_WITH_FAKE_GLOBALS format to annotationlib (#124415)Jelle Zijlstra2024-11-261-3/+6
|
* Fix typo: Use AsyncFor element access in codegen (#127278)Marc Mueller2024-11-261-1/+1
| | | Use AsyncFor element access in codegen
* gh-126612: Include stack effects of uops when computing maximum stack depth ↵mpage2024-11-261-23/+43
| | | | (#126894)
* gh-127022: Remove `_PyEvalFramePushAndInit_UnTagged` (gh-127168)Sam Gross2024-11-251-31/+4
| | | | | The interpreter now handles `_PyStackRef`s pointing to immortal objects without the deferred bit set, so `_PyEvalFramePushAndInit_UnTagged` is no longer necessary.
* gh-127238: adjust error message for sys.set_int_max_str_digits() (#127241)Sergey B Kirpichev2024-11-251-1/+1
| | | Now it's correct and closer to Python/initconfig.c
* gh-115999: Record success in `specialize` (#127167)mpage2024-11-221-0/+1
| | | | | | | Record success in `specialize` This matches the existing behavior where we increment the success stat for the generic opcode each time we successfully specialize an instruction.
* gh-109746: Make _thread.start_new_thread delete state of new thread on its ↵Radislav Chugunov2024-11-221-1/+3
| | | | | | | | | | startup failure (GH-109761) If Python fails to start newly created thread due to failure of underlying PyThread_start_new_thread() call, its state should be removed from interpreter' thread states list to avoid its double cleanup. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* GH-89435: os.path should not be a frozen module (#126924)Filipe Laíns 🇵🇸2024-11-221-2/+0
|
* gh-127022: Simplify `PyStackRef_FromPyObjectSteal` (#127024)Sam Gross2024-11-223-67/+43
| | | | | | | | | This gets rid of the immortal check in `PyStackRef_FromPyObjectSteal()`. Overall, this improves performance about 2% in the free threading build. This also renames `PyStackRef_Is()` to `PyStackRef_IsExactly()` because the macro requires that the tag bits of the arguments match, which is only true in certain special cases.
* gh-115999: Add free-threaded specialization for `UNPACK_SEQUENCE` (#126600)Kirill Podoprigora2024-11-224-28/+70
| | | | | | | | | | | Add free-threaded specialization for `UNPACK_SEQUENCE` opcode. `UNPACK_SEQUENCE_TUPLE/UNPACK_SEQUENCE_TWO_TUPLE` are already thread safe since tuples are immutable. `UNPACK_SEQUENCE_LIST` is not thread safe because of nature of lists (there is nothing preventing another thread from adding items to or removing them the list while the instruction is executing). To achieve thread safety we add a critical section to the implementation of `UNPACK_SEQUENCE_LIST`, especially around the parts where we check the size of the list and push items onto the stack. --------- Co-authored-by: Matt Page <mpage@meta.com> Co-authored-by: mpage <mpage@cs.stanford.edu>
* gh-115999: Add free-threaded specialization for ``TO_BOOL`` (gh-126616)Donghee Na2024-11-214-69/+74
|
* gh-115999: Specialize `LOAD_GLOBAL` in free-threaded builds (#126607)mpage2024-11-215-58/+115
| | | | | | | | | | | | | | Enable specialization of LOAD_GLOBAL in free-threaded builds. Thread-safety of specialization in free-threaded builds is provided by the following: A critical section is held on both the globals and builtins objects during specialization. This ensures we get an atomic view of both builtins and globals during specialization. Generation of new keys versions is made atomic in free-threaded builds. Existing helpers are used to atomically modify the opcode. Thread-safety of specialized instructions in free-threaded builds is provided by the following: Relaxed atomics are used when loading and storing dict keys versions. This avoids potential data races as the dict keys versions are read without holding the dictionary's per-object lock in version guards. Dicts keys objects are passed from keys version guards to the downstream uops. This ensures that we are loading from the correct offset in the keys object. Once a unicode key has been stored in a keys object for a combined dictionary in free-threaded builds, the offset that it is stored in will never be reused for a different key. Once the version guard passes, we know that we are reading from the correct offset. The dictionary read fast-path is used to read values from the dictionary once we know the correct offset.
* gh-114940: Add _Py_FOR_EACH_TSTATE_UNLOCKED(), and Friends (gh-127077)Eric Snow2024-11-215-83/+64
| | | This is a precursor to the actual fix for gh-114940, where we will change these macros to use the new lock. This change is almost entirely mechanical; the exceptions are the loops in codeobject.c and ceval.c, which now hold the "head" lock. Note that almost all of the uses of _Py_FOR_EACH_TSTATE_UNLOCKED() here will change to _Py_FOR_EACH_TSTATE_BEGIN() once we add the new per-interpreter lock.
* gh-124470: Fix crash when reading from object instance dictionary while ↵Dino Viehland2024-11-211-20/+29
| | | | | replacing it (#122489) Delay free a dictionary when replacing it
* gh-126780: Fix `ntpath.normpath()` for drive-relative paths (GH-126801)Nice Zombies2024-11-211-25/+26
|
* gh-115999: Don't take a reason in unspecialize (#127030)mpage2024-11-201-4/+9
| | | | | | | Don't take a reason in unspecialize We only want to compute the reason if stats are enabled. Optimizing compilers should optimize this away for us (gcc and clang do), but it's better to be safe than sorry.
* gh-121058: Warn if `PyThreadState_Clear` is called with an exception set ↵Peter Bierma2024-11-201-0/+5
| | | | (gh-121343)
* GH-127010: Don't lazily track and untrack dicts (GH-127027)Mark Shannon2024-11-205-51/+5
|
* GH-126892: Reset warmup counters when JIT compiling code (GH-126893)Brandt Bucher2024-11-203-10/+20
|
* gh-126914: Store the Preallocated Thread State's Pointer in a ↵Eric Snow2024-11-191-47/+46
| | | | | PyInterpreterState Field (gh-126989) This approach eliminates the originally reported race. It also gets rid of the deadlock reported in gh-96071, so we can remove the workaround added then.
* GH-124567: Replace quadratic assert with linear one (GH-127009)Mark Shannon2024-11-191-1/+1
|
* gh-126076: Account for relocated objects in tracemalloc (#126077)Pablo Galindo Salgado2024-11-191-5/+1
|
* Revert "GH-126491: GC: Mark objects reachable from roots before doing cycle ↵Hugo van Kemenade2024-11-197-219/+82
| | | | collection (GH-126502)" (#126983)
* gh-126986: Drop _PyInterpreterState_FailIfNotRunning() (gh-126988)Eric Snow2024-11-192-14/+9
| | | We replace it with _PyErr_SetInterpreterAlreadyRunning().
* GH-126491: GC: Mark objects reachable from roots before doing cycle ↵Mark Shannon2024-11-187-82/+219
| | | | | | | | | | | | | | | | collection (GH-126502) * Mark almost all reachable objects before doing collection phase * Add stats for objects marked * Visit new frames before each increment * Remove lazy dict tracking * Update docs * Clearer calculation of work to do.
* gh-125063: marshal: Add version 5, improve documentation (GH-126829)Petr Viktorin2024-11-151-15/+31
| | | | | | | | | | * Document that slices can be marshalled * Deduplicate and organize the list of supported types in docs * Organize the type code list in marshal.c, to make it more obvious that this is a versioned format * Back-fill some historical info Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* gh-126312: Don't traverse frozen objects on the free-threaded build (#126338)Peter Bierma2024-11-151-5/+14
| | | | | Also, _PyGC_Freeze() no longer freezes unreachable objects. Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
* GH-124567: Reduce overhead of debug build for GC. Should help CI performance ↵Mark Shannon2024-11-151-1/+9
| | | | (GH-126777)
* gh-103951: enable optimization for fast attribute access on module ↵Sergey B Kirpichev2024-11-154-4/+4
| | | | | subclasses (GH-126264) Co-authored-by: Nicolas Tessore <n.tessore@ucl.ac.uk>
* gh-126757: fix minor typo (GH-126758)Yuxuan Zhang2024-11-121-1/+1
|
* gh-126688: Reinit import lock after fork (#126692)Sam Gross2024-11-121-0/+7
| | | | | | The PyMutex implementation supports unlocking after fork because we clear the list of waiters in parking_lot.c. This doesn't work as well for _PyRecursiveMutex because on some systems, such as SerenityOS, the thread id is not preserved across fork().
* gh-76785: Improved Subinterpreters Compatibility with 3.12 (2/2) (gh-126707)Eric Snow2024-11-122-73/+165
| | | | | | | | | These changes makes it easier to backport the _interpreters, _interpqueues, and _interpchannels modules to Python 3.12. This involves the following: * add the _PyXI_GET_STATE() and _PyXI_GET_GLOBAL_STATE() macros * add _PyXIData_lookup_context_t and _PyXIData_GetLookupContext() * add _Py_xi_state_init() and _Py_xi_state_fini()
* gh-126133: Only use start year in PSF copyright, remove end years (#126236)Hugo van Kemenade2024-11-121-1/+1
|
* gh-126209: Fix inconsistency of `skip_file_prefixes` in `warnings.warn`'s C ↵Daehee Kim2024-11-121-1/+2
| | | | | | | and Python implementations (GH-126329) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* GH-126195: Use M1 JIT memory protection APIs (GH-126196)Diego Russo2024-11-121-2/+16
|
* gh-76785: Improved Subinterpreters Compatibility with 3.12 (1/2) (gh-126704)Eric Snow2024-11-113-19/+25
| | | | | | | | | These changes makes it easier to backport the _interpreters, _interpqueues, and _interpchannels modules to Python 3.12. This involves the following: * rename several structs and typedefs * add several typedefs * stop using the PyThreadState.state field directly in parking_lot.c
* gh-76785: Minor Cleanup of Exception-related Cross-interpreter State (gh-126602)Eric Snow2024-11-112-55/+72
| | | This change makes it easier to backport the _interpreters, _interpqueues, and _interpchannels modules to Python 3.12.
* gh-120619: Strength reduce function guards, support 2-operand uop forms ↵Ken Jin2024-11-098-100/+163
| | | | | (GH-124846) Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* gh-126072: Set docstring attribute for module and class (#126231)Xuanteng Huang2024-11-082-16/+21
|
* gh-126579: Adapt sys.audit() to Argument Clinic (GH-126580)Serhiy Storchaka2024-11-082-42/+63
|
* gh-122943: Add the varpos parameter in _PyArg_UnpackKeywords (GH-126564)Serhiy Storchaka2024-11-089-35/+63
| | | | Remove _PyArg_UnpackKeywordsWithVararg. Add comments for integer arguments of _PyArg_UnpackKeywords.
* gh-126171: fix possible null dereference in _imp_find_frozen_impl (#126566)Valery Fedorenko2024-11-081-1/+1
|
* gh-122943: Remove the object converter for var-positional parameter (GH-126560)Serhiy Storchaka2024-11-082-19/+16
|