summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-74929: Implement PEP 667 (GH-115153)Tian Gao2024-05-042-199/+662
|
* gh-118527: Intern filename, name, and qualname in code objects. (#118558)Sam Gross2024-05-031-0/+5
| | | | | | This interns the strings for `co_filename`, `co_name`, and `co_qualname` on codeobjects in the free-threaded build. This partially addresses a reference counting bottleneck when creating closures concurrently. The closures take the name and qualified name from the code object.
* gh-117657: Disable the function/code cache in free-threaded builds (#118301)mpage2024-05-032-0/+16
| | | | This is only used by the specializing interpreter and the tier 2 optimizer, both of which are disabled in free-threaded builds.
* gh-118527: Use deferred reference counting for C functions on modules (#118529)Sam Gross2024-05-031-0/+1
| | | | | This addresses a scaling bottleneck in the free-threaded build when calling functions like `math.floor()` concurrently from multiple threads.
* gh-116322: Add Py_mod_gil module slot (#116882)Brett Simmers2024-05-032-0/+36
| | | | | | | | | | | | | | This PR adds the ability to enable the GIL if it was disabled at interpreter startup, and modifies the multi-phase module initialization path to enable the GIL when loading a module, unless that module's spec includes a slot indicating it can run safely without the GIL. PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148. A warning will be issued up to once per interpreter for the first GIL-using module that is loaded. If `-v` is given, a shorter message will be printed to stderr every time a GIL-using module is loaded (including the first one that issues a warning).
* gh-116126: Implement PEP 696 (#116129)Jelle Zijlstra2024-05-032-47/+450
| | | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* gh-116738: Make `_codecs` module thread-safe (#117530)Brett Simmers2024-05-021-1/+5
| | | | | | | | | | | | | | | The module itself is a thin wrapper around calls to functions in `Python/codecs.c`, so that's where the meaningful changes happened: - Move codecs-related state that lives on `PyInterpreterState` to a struct declared in `pycore_codecs.h`. - In free-threaded builds, add a mutex to `codecs_state` to synchronize operations on `search_path`. Because `search_path_mutex` is used as a normal mutex and not a critical section, we must be extremely careful with operations called while holding it. - The codec registry is explicitly initialized as part of `_PyUnicode_InitEncodings` to simplify thread-safety.
* gh-118519: Fix empty weakref list check (#118520)Dino Viehland2024-05-021-1/+1
| | | Fix empty list check
* gh-117657: Fix TSAN list set failure (#118260)Dino Viehland2024-05-021-3/+6
| | | | | | | | | | | * Fix TSAN list set failure * Relaxed atomic is sufficient, add targetted test * More list * Remove atomic assign in list * Fixup white space
* gh-93502: Add new C-API functions to trace object creation and destruction ↵Pablo Galindo Salgado2024-05-021-6/+31
| | | | (#115945)
* GH-118095: Make invalidating and clearing executors memory safe (GH-118459)Mark Shannon2024-05-011-1/+2
|
* GH-117881: fix athrow().throw()/asend().throw() concurrent access (GH-117882)Thomas Grainger2024-05-011-0/+37
|
* gh-118335: Configure Tier 2 interpreter at build time (#118339)Guido van Rossum2024-05-012-0/+10
| | | | | | | | | | | | | | | | | | | | | | The code for Tier 2 is now only compiled when configured with `--enable-experimental-jit[=yes|interpreter]`. We drop support for `PYTHON_UOPS` and -`Xuops`, but you can disable the interpreter or JIT at runtime by setting `PYTHON_JIT=0`. You can also build it without enabling it by default using `--enable-experimental-jit=yes-off`; enable with `PYTHON_JIT=1`. On Windows, the `build.bat` script supports `--experimental-jit`, `--experimental-jit-off`, `--experimental-interpreter`. In the C code, `_Py_JIT` is defined as before when the JIT is enabled; the new variable `_Py_TIER2` is defined when the JIT *or* the interpreter is enabled. It is actually a bitmask: 1: JIT; 2: default-off; 4: interpreter.
* [gh-117657] Fix some issues with TSAN in typeobject (#118249)Dino Viehland2024-04-301-6/+11
| | | Fix some racing reads in typebobject.c
* gh-117657: Fix small issues with instrumentation and TSAN (#118064)Dino Viehland2024-04-301-3/+5
| | | Small TSAN fixups for instrumentation
* gh-118272: Clear generator frame's locals when the generator is closed (#118277)Irit Katriel2024-04-301-0/+1
| | | Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* gh-118331: Handle errors in _PyObject_SetManagedDict (#118334)Sam Gross2024-04-292-12/+19
| | | | | When detaching a dict, the `copy_values` call may fail due to out-of-memory errors. This can be triggered by test_no_memory in test_repl.
* gh-117783: Immortalize objects that use deferred reference counting (#118112)Sam Gross2024-04-291-0/+7
| | | | | | | | | Deferred reference counting is not fully implemented yet. As a temporary measure, we immortalize objects that would use deferred reference counting to avoid multi-threaded scaling bottlenecks. This is only performed in the free-threaded build once the first non-main thread is started. Additionally, some tests, including refleak tests, suppress this behavior.
* gh-118331: Don't raise an error if tuple allocation fails when clearing ↵mpage2024-04-291-1/+3
| | | | | | | | | | weakrefs (#118338) It's not safe to raise an exception in `PyObject_ClearWeakRefs()` if one is not already set, since it may be called by `_Py_Dealloc()`, which requires that the active exception does not change. Additionally, make sure we clear the weakrefs even when tuple allocation fails.
* gh-107674: Lazy load line number to improve performance of tracing (GH-118127)Tian Gao2024-04-291-4/+12
|
* gh-112075: _Py_dict_lookup needs to lock shared keys (#117528)Dino Viehland2024-04-251-127/+158
| | | | | Lock shared keys in `Py_dict_lookup` and use thread-safe lookup in `insertdict` Co-authored-by: Sam Gross <colesbury@gmail.com>
* gh-117657: Fixes a few small TSAN issues in dictobject (#118200)Dino Viehland2024-04-251-11/+14
| | | | Fixup TSAN errors for dict
* gh-112069: Do not require lock if the set has never been exposed. (gh-118069)Donghee Na2024-04-251-0/+7
|
* gh-117578: Introduce _PyType_GetModuleByDef2 private function (GH-117661)neonene2024-04-251-7/+45
| | | | Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
* GH-118095: Handle `RETURN_GENERATOR` in tier 2 (GH-118180)Mark Shannon2024-04-251-5/+0
|
* gh-108191: Add support of positional argument in SimpleNamespace constructor ↵Serhiy Storchaka2024-04-241-3/+21
| | | | | | | (GH-108195) SimpleNamespace({'a': 1, 'b': 2}) and SimpleNamespace([('a', 1), ('b', 2)]) are now the same as SimpleNamespace(a=1, b=2).
* GH-117536: GH-117894: fix athrow().throw(...) unawaited warning (GH-117851)Thomas Grainger2024-04-241-1/+8
|
* gh-95754: Better error when script shadows a standard library or third party ↵Shantanu2024-04-231-53/+191
| | | | module (#113769)
* gh-112075: Make instance attributes stored in inline "dict" thread safe ↵Dino Viehland2024-04-223-103/+357
| | | | | (#114742) Make instance attributes stored in inline "dict" thread safe on free-threaded builds
* ``Objects/typeobject.c``: Fix typo (#118126)Kirill Podoprigora2024-04-211-1/+1
|
* [gh-117657] _Py_MergeZeroLocalRefcount isn't loading ob_ref_shared with ↵Dino Viehland2024-04-191-1/+1
| | | | | strong enough semantics (#118111) Use acquire for load of ob_ref_shared
* Fix a typo in dictobject.c documentation (#117515)Noah Kim2024-04-191-1/+1
|
* gh-117657: use relaxed loads for checking dict keys immortality (#118067)Dino Viehland2024-04-191-2/+2
| | | Use relaxed load to check if dictkeys are immortal
* setobject: remove out of date docstring info (GH-118048)Rostyslav Lobov2024-04-191-1/+1
|
* gh-112069: Make PySet_GET_SIZE to be atomic safe. (gh-118053)Donghee Na2024-04-181-1/+0
| | | gh-112069: Make PySet_GET_SIZE to be atomic operation
* gh-112069: Add _PySet_NextEntryRef to be thread-safe. (gh-117990)Donghee Na2024-04-183-5/+21
|
* fix formatting of literal in docstring of int.from_bytes and int.to_bytes ↵Jens Hedegaard Nielsen2024-04-182-7/+7
| | | | (#117847)
* Fix two typos in `typeobject.c` (#118024)Nikita Sobolev2024-04-181-2/+2
|
* gh-94673: Fix compiler warning in typeobject.c (#117980)Erlend E. Aasland2024-04-171-0/+2
|
* gh-117657: Fix data races in the method cache in free-threaded builds (#117954)mpage2024-04-171-3/+5
| | | | | | | | | Fix data races in the method cache in free-threaded builds These are technically data races, but I think they're benign (to the extent that that is actually possible). We update cache entries non-atomically but read them atomically from another thread, and there's nothing that establishes a happens-before relationship between the reads and writes that I can see.
* gh-117680: make _PyInstructionSequence a PyObject and use it in tests (#117629)Irit Katriel2024-04-171-0/+2
|
* GH-117760: Streamline the trashcan mechanism (GH-117763)Mark Shannon2024-04-171-99/+15
|
* gh-117755: Fix mimalloc for huge allocation on s390x (#117809)Victor Stinner2024-04-161-0/+6
| | | | | | | | Fix mimalloc allocator for huge memory allocation (around 8,589,934,592 GiB) on s390x. Abort allocation early in mimalloc if the number of slices doesn't fit into uint32_t, to prevent a integer overflow (cast 64-bit size_t to uint32_t).
* gh-117376: Make code objects use deferred reference counting (#117823)Sam Gross2024-04-161-1/+32
| | | | | | We want code objects to use deferred reference counting in the free-threaded build. This requires them to be tracked by the GC, so we set `Py_TPFLAGS_HAVE_GC` in the free-threaded build, but not the default build.
* gh-112069: Make setiter_iternext to be thread-safe (gh-117935)Donghee Na2024-04-161-12/+17
|
* GH-117750: When clearing object's dict, clear inline values but leave dict ↵Mark Shannon2024-04-151-15/+18
| | | | attached (GH-117808)
* gh-117826: Remove lookdict_index from delitemif_lock_held (gh-117869)Donghee Na2024-04-151-5/+2
|
* gh-94673: Clarify About Runtime State Related to Static Builtin Types ↵Eric Snow2024-04-121-1/+6
| | | | | | | | (gh-117761) Guido pointed out to me that some details about the per-interpreter state for the builtin types aren't especially clear. I'm addressing that by: * adding a comment explaining that state * adding some asserts to point out the relationship between each index and the interp/global runtime state
* gh-117376: Partial implementation of deferred reference counting (#117696)Sam Gross2024-04-125-18/+44
| | | | | This marks objects as using deferred refrence counting using the `ob_gc_bits` field in the free-threaded build and collects those objects during GC.
* gh-117764: Add docstrings and signatures for the types of None, Ellipsis and ↵Serhiy Storchaka2024-04-122-3/+18
| | | | NotImplemented (GH-117813)