summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-112075: Make instance attributes stored in inline "dict" thread safe ↵Dino Viehland2024-04-224-24/+17
| | | | | (#114742) Make instance attributes stored in inline "dict" thread safe on free-threaded builds
* gh-116818: Make `sys.settrace`, `sys.setprofile`, and monitoring thread-safe ↵Dino Viehland2024-04-197-60/+214
| | | | | | | (#116775) Makes sys.settrace, sys.setprofile, and monitoring generally thread-safe. Mostly uses a stop-the-world approach and synchronization around the code object's _co_instrumentation_version. There may be a little bit of extra synchronization around the monitoring data that's required to be TSAN clean.
* gh-114099: Modify preprocessor symbol usage to support older macOS SDKs ↵Russell Keith-Magee2024-04-191-1/+2
| | | | | (GH-118073) Co-authored-by: Joshua Root jmr@macports.org
* GH-116202: Incorporate invalidation check into _START_EXECUTOR. (GH-118044)Mark Shannon2024-04-194-3/+9
|
* GH-115419: Improve list of escaping functions (GH-118054)Mark Shannon2024-04-191-1/+3
|
* gh-117535: Change unknown filename of warnings from `sys` to `<sys>` (#118018)Tian Gao2024-04-191-2/+2
|
* gh-112069: Add _PySet_NextEntryRef to be thread-safe. (gh-117990)Donghee Na2024-04-182-11/+19
|
* GH-118036: Fix a bug with CALL_STAT_INC (#117933)Guido van Rossum2024-04-181-2/+0
| | | | | | | We were under-counting calls in `_PyEvalFramePushAndInit` because the `CALL_STAT_INC` macro was redefined to a no-op for the Tier 2 interpreter. The fix is not to `#undef` it at all. This results in ~37% more "Frames pushed" reported under "Call stats".
* gh-117987: Restore several functions removed in Python 3.13 alpha 1 (GH-117993)Victor Stinner2024-04-182-8/+4
| | | | | | | | | Restore these functions removed in Python 3.13 alpha 1: * Py_SetPythonHome() * Py_SetProgramName() * PySys_SetArgvEx() * PySys_SetArgv()
* GH-115419: Tidy up tier 2 optimizer. Merge peephole pass into main pass ↵Mark Shannon2024-04-183-132/+169
| | | | (GH-117997)
* gh-118023: Fix reference leak (#118025)Kirill Podoprigora2024-04-181-0/+2
|
* gh-117657: Quiet erroneous TSAN reports of data races in `_PySeqLock` (#117955)mpage2024-04-171-3/+3
| | | | | | | | Quiet erroneous TSAN reports of data races in `_PySeqLock` TSAN reports a couple of data races between the compare/exchange in `_PySeqLock_LockWrite` and the non-atomic loads in `_PySeqLock_{Abandon,Unlock}Write`. This is another instance of TSAN incorrectly modeling failed compare/exchange as a write instead of a load.
* gh-117680: make _PyInstructionSequence a PyObject and use it in tests (#117629)Irit Katriel2024-04-173-164/+638
|
* gh-117929: Restore removed PyEval_InitThreads() function (#117931)Victor Stinner2024-04-171-2/+1
|
* GH-117760: Streamline the trashcan mechanism (GH-117763)Mark Shannon2024-04-171-0/+2
|
* gh-115178: Add Counts of UOp Pairs to pystats (GH-115181)Jeff Glass2024-04-162-0/+11
|
* gh-117657: Quiet more TSAN warnings due to incorrect modeling of ↵mpage2024-04-151-2/+2
| | | | compare/exchange (#117830)
* gh-117657: Quiet TSAN warning about a data race between `start_the_world()` ↵mpage2024-04-151-1/+2
| | | | | | | | and `tstate_try_attach()` (#117828) TSAN erroneously reports a data race between the `_Py_atomic_compare_exchange_int` on `tstate->state` in `tstate_try_attach()` and the non-atomic load of `tstate->state` in `start_the_world`. The `_Py_atomic_compare_exchange_int` fails, but TSAN erroneously treats it as a store.
* gh-117376: Partial implementation of deferred reference counting (#117696)Sam Gross2024-04-121-1/+18
| | | | | 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: Fix and add signatures for many builtins (GH-117769)Serhiy Storchaka2024-04-124-17/+17
|
* gh-117764: Add signatures for some functions in the sys module (GH-117770)Serhiy Storchaka2024-04-122-35/+73
| | | Use Argument Clinic if possible.
* gh-76785: Handle Legacy Interpreters Properly (gh-117490)Eric Snow2024-04-112-14/+30
| | | This is similar to the situation with threading._DummyThread. The methods (incl. __del__()) of interpreters.Interpreter objects must be careful with interpreters not created by interpreters.create(). The simplest thing to start with is to disable any method that modifies or runs in the interpreter. As part of this, the runtime keeps track of where an interpreter was created. We also handle interpreter "refcounts" properly.
* gh-117649: Raise ImportError for unsupported modules in free-threaded build ↵Sam Gross2024-04-112-1/+19
| | | | | | | | | | (#117651) The free-threaded build does not currently support the combination of single-phase init modules and non-isolated subinterpreters. Ensure that `check_multi_interp_extensions` is always `True` for subinterpreters in the free-threaded build so that importing these modules raises an `ImportError`.
* gh-76785: Add More Tests to test_interpreters.test_api (gh-117662)Eric Snow2024-04-114-15/+299
| | | In addition to the increase test coverage, this is a precursor to sorting out how we handle interpreters created directly via the C-API.
* gh-107674: Remove some unnecessary code in instrumentation code (GH-117393)Tian Gao2024-04-091-1/+1
|
* gh-117439: Make refleak checking thread-safe without the GIL (#117469)Sam Gross2024-04-082-2/+10
| | | | | This keeps track of the per-thread total reference count operations in PyThreadState in the free-threaded builds. The count is merged into the interpreter's total when the thread exits.
* gh-111926: Make weakrefs thread-safe in free-threaded builds (#117168)mpage2024-04-081-0/+9
| | | | | | | | | Most mutable data is protected by a striped lock that is keyed on the referenced object's address. The weakref's hash is protected using the weakref's per-object lock. Note that this only affects free-threaded builds. Apart from some minor refactoring, the added code is all either gated by `ifdef`s or is a no-op (e.g. `Py_BEGIN_CRITICAL_SECTION`).
* GH-117512: Allow 64-bit JIT operands on 32-bit platforms (GH-117527)Brandt Bucher2024-04-061-28/+34
|
* gh-117457: Regen executor cases post PR #117477 (#117559)Erlend E. Aasland2024-04-051-2/+8
|
* GH-117457: Correct pystats uop "miss" counts (GH-117477)Michael Droettboom2024-04-042-136/+536
|
* gh-112075: Make _PyDict_LoadGlobal thread safe (#117529)Dino Viehland2024-04-043-3/+0
| | | Make _PyDict_LoadGlobal threadsafe
* gh-117494: extract the Instruction Sequence data structure into a separate ↵Irit Katriel2024-04-044-180/+196
| | | | file (#117496)
* gh-116968: Reimplement Tier 2 counters (#117144)Guido van Rossum2024-04-048-171/+117
| | | | | | | | | | | | Introduce a unified 16-bit backoff counter type (``_Py_BackoffCounter``), shared between the Tier 1 adaptive specializer and the Tier 2 optimizer. The API used for adaptive specialization counters is changed but the behavior is (supposed to be) identical. The behavior of the Tier 2 counters is changed: - There are no longer dynamic thresholds (we never varied these). - All counters now use the same exponential backoff. - The counter for ``JUMP_BACKWARD`` starts counting down from 16. - The ``temperature`` in side exits starts counting down from 64.
* gh-116168: Remove extra `_CHECK_STACK_SPACE` uops (#117242)Peter Lazorchak2024-04-034-17/+104
| | | This merges all `_CHECK_STACK_SPACE` uops in a trace into a single `_CHECK_STACK_SPACE_OPERAND` uop that checks whether there is enough stack space for all calls included in the entire trace.
* gh-76785: Raise InterpreterError, Not RuntimeError (gh-117489)Eric Snow2024-04-033-6/+22
| | | | | I had meant to switch everything to InterpreterError when I added it a while back. At the time I missed a few key spots. As part of this, I've added print-the-exception to _PyXI_InitTypes() and fixed an error case in `_PyStaticType_InitBuiltin().
* gh-76785: Fix a Refleak in _interpreters.new_config() (gh-117491)Eric Snow2024-04-031-0/+2
| | | This is a follow-up to gh-117170 and gh-117485.
* gh-76785: Add PyInterpreterConfig Helpers (gh-117170)Eric Snow2024-04-023-22/+305
| | | These helpers make it easier to customize and inspect the config used to initialize interpreters. This is especially valuable in our tests. I found inspiration from the PyConfig API for the PyInterpreterConfig dict conversion stuff. As part of this PR I've also added a bunch of tests.
* Fix successor opcode name printing in Tier 2 DEOPT debug message (#117471)Guido van Rossum2024-04-021-1/+1
|
* GH-115776: Embed the values array into the object, for "normal" Python ↵Mark Shannon2024-04-027-110/+106
| | | | objects. (GH-116115)
* gh-117411: move PyFutureFeatures to pycore_symtable.h and make it private ↵Irit Katriel2024-04-026-15/+16
| | | | (#117412)
* Silence compiler warnings in gc.c (#117422)Guido van Rossum2024-04-011-0/+3
|
* gh-91565: Replace bugs.python.org links with Devguide/GitHub ones (GH-91568)Steve (Gadget) Barnes2024-04-011-1/+1
| | | | | | Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
* gh-117303: Don't detach in `PyThreadState_DeleteCurrent()` (#117304)Sam Gross2024-03-291-2/+0
| | | | | | | | | | | This fixes a crash in `test_threading.test_reinit_tls_after_fork()` when running with the GIL disabled. We already properly handle the case where the thread state is `_Py_THREAD_ATTACHED` in `tstate_delete_common()` -- we just need to remove an assertion. Keeping the thread attached means that a stop-the-world pause, such as for a `fork()`, won't commence until we remove our thread state from the interpreter's linked list. This prevents a crash when the child process tries to clean up the dead thread states.
* gh-116664: In _warnings.c, make filters_version access thread-safe (#117374)Erlend E. Aasland2024-03-291-6/+9
| | | | - assert that the lock is held in already_warned() - protect 'filters_version' increment in warnings_filters_mutated_impl()
* gh-117300: Use stop the world to make `sys._current_frames` and ↵Sam Gross2024-03-291-0/+4
| | | | | | | | | | `sys._current_exceptions` thread-safe. (#117301) This adds a stop the world pause to make the two functions thread-safe when the GIL is disabled in the free-threaded build. Additionally, the main test thread may call `sys._current_exceptions()` as soon as `g_raised.set()` is called. The background thread may not yet reach the `leave_g.wait()` line.
* gh-117323: Make `cell` thread-safe in free-threaded builds (#117330)Sam Gross2024-03-294-36/+23
| | | Use critical sections to lock around accesses to cell contents. The critical sections are no-ops in the default (with GIL) build.
* gh-112529: Don't untrack tuples or dicts with zero refcount (#117370)Sam Gross2024-03-291-15/+18
| | | | | | | | The free-threaded GC sometimes sees objects with zero refcount. This can happen due to the delay in merging biased reference counting fields, and, in the future, due to deferred reference counting. We should not untrack these objects or they will never be collected. This fixes the refleaks in the free-threaded build.
* gh-116664: Fix unused var warnings in _warnings.c in non-free-threaded ↵Erlend E. Aasland2024-03-291-0/+8
| | | | | builds (#117373) The warnings were introduced by commit c1712ef06.
* GH-117121: Add pystats to JIT builds (GH-117346)Michael Droettboom2024-03-282-1/+3
|
* gh-116664: Make module state Py_SETREF's in _warnings thread-safe (#116959)Erlend E. Aasland2024-03-281-21/+37
| | | | | | Mark the swap operations as critical sections. Add an internal Py_BEGIN_CRITICAL_SECTION_MUT API that takes a PyMutex pointer instead of a PyObject pointer.