summaryrefslogtreecommitdiffstats
path: root/Tools
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] Ignore some failing tests in emulated JIT CI (GH-120977)Miss Islington (bot)2024-06-261-1/+4
| | | | (cherry picked from commit 07daaf1ce10eb6d7a5ca9ea7c9055bf571d9e57f) Co-authored-by: Diego Russo <diego.russo@arm.com>
* [3.13] gh-113993: Allow interned strings to be mortal, and fix related ↵Petr Viktorin2024-06-242-5/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | issues (GH-120520) (GH-120945) * Add an InternalDocs file describing how interning should work and how to use it. * Add internal functions to *explicitly* request what kind of interning is done: - `_PyUnicode_InternMortal` - `_PyUnicode_InternImmortal` - `_PyUnicode_InternStatic` * Switch uses of `PyUnicode_InternInPlace` to those. * Disallow using `_Py_SetImmortal` on strings directly. You should use `_PyUnicode_InternImmortal` instead: - Strings should be interned before immortalization, otherwise you're possibly interning a immortalizing copy. - `_Py_SetImmortal` doesn't handle the `SSTATE_INTERNED_MORTAL` to `SSTATE_INTERNED_IMMORTAL` update, and those flags can't be changed in backports, as they are now part of public API and version-specific ABI. * Add private `_only_immortal` argument for `sys.getunicodeinternedsize`, used in refleak test machinery. * Make sure the statically allocated string singletons are unique. This means these sets are now disjoint: - `_Py_ID` - `_Py_STR` (including the empty string) - one-character latin-1 singletons Now, when you intern a singleton, that exact singleton will be interned. * Add a `_Py_LATIN1_CHR` macro, use it instead of `_Py_ID`/`_Py_STR` for one-character latin-1 singletons everywhere (including Clinic). * Intern `_Py_STR` singletons at startup. * For free-threaded builds, intern `_Py_LATIN1_CHR` singletons at startup. * Beef up the tests. Cover internal details (marked with `@cpython_only`). * Add lots of assertions Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.13] GH-120602: Support LLVM_VERSION_SUFFIX for JIT builds (GH-120768)Miss Islington (bot)2024-06-201-1/+1
| | | | | (cherry picked from commit 285f42c850da0d8ca31850088eb7b9247cbbbc71) Co-authored-by: Xarblu <xarblu@protonmail.com>
* [3.13] gh-117657: Fix `__slots__` thread safety in free-threaded build ↵Miss Islington (bot)2024-06-171-2/+0
| | | | | | | | | (GH-119368) (#120655) Fix a race in `PyMember_GetOne` and `PyMember_SetOne` for `Py_T_OBJECT_EX`. These functions implement `__slots__` accesses for Python objects. (cherry picked from commit 362cd2680b45a36c3467b9721ff7fc0ceb338452) Co-authored-by: Daniele Parmeggiani <8658291+dpdani@users.noreply.github.com>
* [3.13] gh-117657: Fix TSan reported data race on ioctl_works (GH-120175) ↵Miss Islington (bot)2024-06-171-1/+0
| | | | | | | (#120654) (cherry picked from commit 460cc9e14e221c53c0038a847bfd411fe184ebf3) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.13] gh-120433: Mention ``chocolatey`` for installing llvm on Windows as ↵Miss Islington (bot)2024-06-171-0/+6
| | | | | | | | an alternative option (GH-120434) (#120651) gh-120433: Mention ``chocolatey`` for installing llvm on Windows as an alternative option (GH-120434) (cherry picked from commit 95737bbf18765a24b6585708588c9b707dc30d27) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* [3.13] gh-117657: Add TSAN suppression for set_default_allocator_unlocked ↵Miss Islington (bot)2024-06-141-0/+2
| | | | | | | | | | (GH-120500) (#120510) gh-117657: Add TSAN suppression for set_default_allocator_unlocked (GH-120500) Add TSAN suppression for set_default_allocator_unlocked (cherry picked from commit 2bacc2343c24c49292dea3461f6b7664fc2d33e2) Co-authored-by: AN Long <aisk@users.noreply.github.com>
* [3.13] gh-117657: Make PyType_HasFeature atomic (GH-120210) (#120443)Miss Islington (bot)2024-06-131-1/+0
| | | | | | | | gh-117657: Make PyType_HasFeature atomic (GH-120210) Make PyType_HasFeature atomic (cherry picked from commit eebae2c460dabdc70dc0d9b6e189368eb1abb716) Co-authored-by: Ken Jin <kenjin@python.org>
* [3.13] gh-71587: Drop local reference cache to `_strptime` module in ↵Miss Islington (bot)2024-06-121-1/+0
| | | | | | | | | `_datetime` (gh-120424) The _strptime module object was cached in a static local variable (in the datetime.strptime() implementation). That's a problem when it crosses isolation boundaries, such as reinitializing the runtme or between interpreters. This change fixes the problem by dropping the static variable, instead always relying on the normal sys.modules cache (via PyImport_Import()). (cherry picked from commit 127c1d2771749853e287632c086b6054212bf12a, AKA gh-120224) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
* [3.13] gh-117657: Make Py_TYPE and Py_SET_TYPE thread safe (GH-120165) ↵Miss Islington (bot)2024-06-121-2/+0
| | | | | | | | | | (GH-120403) gh-117657: Make Py_TYPE and Py_SET_TYPE thread safe (GH-120165) (cherry picked from commit e16aed63f64b18a26859eff3de976ded373e66b8) Co-authored-by: Ken Jin <kenjin@python.org> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
* [3.13] gh-117657: Fix TSAN race involving import lock (GH-118523) (#120169)Miss Islington (bot)2024-06-061-4/+0
| | | | | | | | This adds a `_PyRecursiveMutex` type based on `PyMutex` and uses that for the import lock. This fixes some data races in the free-threaded build and generally simplifies the import lock code. (cherry picked from commit e21057b99967eb5323320e6d1121955e0cd2985e) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.13] gh-117657: Fix race involving GC and heap initialization (GH-119923) ↵Miss Islington (bot)2024-06-041-3/+0
| | | | | | | | | | | | | | | | | (#120038) The `_PyThreadState_Bind()` function is called before the first `PyEval_AcquireThread()` so it's not synchronized with the stop the world GC. We had a race where `gc_visit_heaps()` might visit a thread's heap while it's being initialized. Use a simple atomic int to avoid visiting heaps for threads that are not yet fully initialized (i.e., before `tstate_mimalloc_bind()` is called). The race was reproducible by running: `python Lib/test/test_importlib/partial/pool_in_threads.py`. (cherry picked from commit e69d068ad0bd6a25434ea476a647b635da4d82bb) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.13] gh-117398: Use Per-Interpreter State for the _datetime Static Types ↵Miss Islington (bot)2024-06-032-0/+2
| | | | | | | | | | | (gh-120009) We make use of the same mechanism that we use for the static builtin types. This required a few tweaks. This change is the final piece needed to make _datetime support multiple interpreters. I've updated the module slot accordingly. (cherry picked from commit 105f22ea46ac16866e6df18ebae2a8ba422b7f45, AKA gh-119929) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.13] gh-117657: Fix itertools.count thread safety (GH-119268) (#120007)Sam Gross2024-06-031-1/+0
| | | | | | Fix itertools.count in free-threading mode (cherry picked from commit 87939bd5790accea77c5a81093f16f28d3f0b429) Co-authored-by: Arnon Yaari <wiggin15@yahoo.com>
* [3.13] gh-117657: Fix race involving immortalizing objects (GH-119927) (#120005)Sam Gross2024-06-031-2/+0
| | | | | | | | | | | The free-threaded build currently immortalizes objects that use deferred reference counting (see gh-117783). This typically happens once the first non-main thread is created, but the behavior can be suppressed for tests, in subinterpreters, or during a compile() call. This fixes a race condition involving the tracking of whether the behavior is suppressed. (cherry picked from commit 47fb4327b5c405da6df066dcaa01b7c1aefab313)
* [3.13] gh-117657: Avoid `sem_clockwait` in TSAN (GH-119915) (#119992)Miss Islington (bot)2024-06-031-9/+0
| | | | | | | The `sem_clockwait` function is not currently instrumented, which leads to false positives. (cherry picked from commit 41c1cefbae71d687d1a935233b086473df65e15c) Co-authored-by: Sam Gross <colesbury@gmail.com>
* gh-119679: Ensures correct import libraries are included in Windows install ↵Miss Islington (bot)2024-06-031-8/+14
| | | | | | | packages (GH-119790) (cherry picked from commit fd01271366abefa8f991e53f090387882fbd6bdd) Co-authored-by: Steve Dower <steve.dower@python.org>
* [3.13] gh-117657: Fix data races report by TSAN unicode-hash (gh-119907) ↵Miss Islington (bot)2024-06-031-1/+0
| | | | | | | | (gh-119963) gh-117657: Fix data races report by TSAN unicode-hash (gh-119907) (cherry picked from commit 0594a27e5f1d87d59fa8a761dd8ca9df4e42816d) Co-authored-by: Donghee Na <donghee.na@python.org>
* [3.13] gh-117657: Fix TSAN reported race in `_PyEval_IsGILEnabled`. ↵Miss Islington (bot)2024-06-021-1/+0
| | | | | | | | | (GH-119921) (#119939) The GIL may be disabled concurrently with this call so we need to use a relaxed atomic load. (cherry picked from commit f3b89a63cbb6d46e5ed40d5cd9813cdf9189ce35) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.13] gh-117657: Add TSAN suppression for `set_discard_entry` (GH-119908) ↵Miss Islington (bot)2024-06-011-0/+2
| | | | | | | | (#119914) Seen in CI occasionally when running `test_weakref`. (cherry picked from commit 7dc745d1f5d9558047a52cad5e01df7567533269) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.13] gh-117657: Fix TSAN race in QSBR assertion (GH-119887) (#119904)Miss Islington (bot)2024-06-011-2/+0
| | | | | | | Due to a limitation in TSAN, all reads from `PyThreadState.state` must be atomic to avoid reported races. (cherry picked from commit 90ec19fd33e2452902b9788d4821f1fbf6542304) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.13] gh-117657: Fix TSAN race in free-threaded GC (GH-119883) (#119903)Miss Islington (bot)2024-06-011-3/+0
| | | | | | | | Only call `gc_restore_tid()` from stop-the-world contexts. `worklist_pop()` can be called while other threads are running, so use a relaxed atomic to modify `ob_tid`. (cherry picked from commit 60593b2052ca275559c11028d50e19f8e5dfee13) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.13] gh-97747: Improvements to WASM browser REPL. (GH-97665) (GH-119828)Miss Islington (bot)2024-05-312-8/+69
| | | | | (cherry picked from commit 010aaa32fb93c5033a698d7213469af02d76fef3) Co-authored-by: Katie Bell <katie@katharos.id.au>
* [3.13] gh-119661: Add _Py_SINGLETON() include in Argumenet Clinic (#119712) ↵Victor Stinner2024-05-291-3/+9
| | | | | | | | | | | (#119716) gh-119661: Add _Py_SINGLETON() include in Argumenet Clinic (#119712) When the _Py_SINGLETON() is used, Argument Clinic now adds an explicit "pycore_runtime.h" include to get the macro. Previously, the macro may or may not be included indirectly by another include. (cherry picked from commit 7ca74a760a5d3cdf48159f003d4db7c2778e9261)
* [3.13] gh-117398: Statically Allocate the Datetime C-API (GH-119472) (gh-119641)Eric Snow2024-05-281-0/+3
| | | | | | | This is a backport of 3 commits that go together. (cherry picked from commit a895756) (cherry picked from commit b30d30c) (cherry picked from commit a89fc26)
* gh-117505: Run ensurepip in isolated env in Windows installer (GH-118257)Miss Islington (bot)2024-05-221-2/+2
| | | | | | ensurepip forks a subprocess to run pip itself, but that subprocess only inherits a -I isolated mode flag (see _run_pip() in Lib/ensurepip/__init__.py), not the "-E -s" flags that the installer has been using. This means that parts of ensurepip don't actually run in an isolated environment and can make incorrect decisions based on packages installed in the user site-packages. (cherry picked from commit c9073eb1a99606df1efeb8959e9f11a8ebc23ae2) Co-authored-by: Michael Vincent <377567+Vynce@users.noreply.github.com>
* [3.13] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across ↵Miss Islington (bot)2024-05-221-0/+2
| | | | | | | | | | | | | Interpreters (gh-119331) (gh-119410) _PyArg_Parser holds static global data generated for modules by Argument Clinic. The _PyArg_Parser.kwtuple field is a tuple object, even though it's stored within a static global. In some cases the tuple is statically allocated and thus it's okay that it gets shared by multiple interpreters. However, in other cases the tuple is set lazily, allocated from the heap using the active interprepreter at the point the tuple is needed. This is a problem once that interpreter is destroyed since _PyArg_Parser.kwtuple becomes at dangling pointer, leading to crashes. It isn't a problem if the tuple is allocated under the main interpreter, since its lifetime is bound to the lifetime of the runtime. The solution here is to temporarily switch to the main interpreter. The alternative would be to always statically allocate the tuple. This change also fixes a bug where only the most recent parser was added to the global linked list. (cherry picked from commit 81865002aee8eaaeb3c7e402f86183afa6de77bf) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.13] gh-112844: Update CPE references for external dependencies ↵Miss Islington (bot)2024-05-201-1/+15
| | | | | | (GH-118521) (#119237) Co-authored-by: Seth Michael Larson <seth@python.org>
* [3.13] GH-118943: Fix a race condition when generating jit_stencils.h ↵Miss Islington (bot)2024-05-161-7/+12
| | | | | (GH-119101) (cherry picked from commit 4702b7b5bdc07d046576b4126cf4e4f5f7145abb)
* [3.13] Explain how to install LLVM on Fedora (GH-119100)Miss Islington (bot)2024-05-161-0/+6
| | | | | (cherry picked from commit ab73bcdf73fed5a23f2e2e37a63d6992f29479a9) Co-authored-by: Miro Hrončok <miro@hroncok.cz> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.13] GH-118836: Fix JIT build error when SHT_NOTE section is present ↵Miss Islington (bot)2024-05-131-0/+1
| | | | | | | (GH-119020) (cherry picked from commit e04cd964eb4eee1b0ae5b2c34727abce6c0fb7f0) Co-authored-by: Michał Górny <mgorny@gentoo.org>
* [3.13] gh-117657: Log TSAN warnings to separate files and archive them ↵Miss Islington (bot)2024-05-101-0/+3
| | | | | | | | | | | | (GH-118747) (#118931) This ensures we don't lose races that occur in subprocesses or interleave races from workers running in parallel. Log files are collected and packaged into a zipfile that can be downloaded from the "Artifacts" section of the workflow run. (cherry picked from commit b88889e9ffd7b2d2bdac75aecbf14e37fd68e337) Co-authored-by: mpage <mpage@meta.com>
* [3.13] gh-117657: Fix QSBR race condition (GH-118843) (#118905)Miss Islington (bot)2024-05-101-1/+0
| | | | | | | | | `_Py_qsbr_unregister` is called when the PyThreadState is already detached, so the access to `tstate->qsbr` isn't safe without locking the shared mutex. Grab the `struct _qsbr_shared` from the interpreter instead. (cherry picked from commit 33d20199af65c741bdc908a968edd8dc179b6974) Co-authored-by: Alex Turner <alexturner@meta.com>
* [3.13] gh-117657: Fix data races reported by TSAN on `interp->threads.main` ↵Miss Islington (bot)2024-05-101-2/+0
| | | | | | | | (GH-118865) (#118904) Use relaxed loads/stores when reading/writing to this field. (cherry picked from commit 22d5185308f85efa22ec1e8251c409fe1cbd9e6b) Co-authored-by: mpage <mpage@meta.com>
* [3.13] gh-117657: Replace TSAN suppresions with more specific rules ↵Miss Islington (bot)2024-05-091-24/+81
| | | | | | | | | | | | | | (GH-118722) (#118870) Using `race:` filters out warnings if the function appears anywhere in the stack trace. This can hide a lot of unrelated warnings, especially for a function like `_PyEval_EvalFrameDefault`, which is somewhere on the stack more often than not. Change all free-threaded suppressions to `race_top:`, which only matches the top frame, and add any new suppressions this exposes. (cherry picked from commit 98ff3f65c0232f31df89ebb52b244625ec9e3eb6) Co-authored-by: Brett Simmers <swtaarrs@users.noreply.github.com>
* [3.13] gh-117657: Fix data races when writing / reading `ob_gc_bits` ↵Miss Islington (bot)2024-05-081-3/+0
| | | | | | | | | | (GH-118292) (#118796) Use relaxed atomics when reading / writing to the field. There are still a few places in the GC where we do not use atomics. Those should be safe as the world is stopped. (cherry picked from commit cb6f75a32ca2649c6cc1cabb0301eb783efbd55b) Co-authored-by: mpage <mpage@meta.com>
* gh-118671: Updated dead ActiveState links (#118730)trag1c2024-05-081-2/+2
| | | | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* gh-118518: Allow perf to work without frame pointers (#112254)Pablo Galindo Salgado2024-05-051-0/+2
|
* build(deps): bump hypothesis from 6.100.0 to 6.100.2 in /Tools (#118462)dependabot[bot]2024-05-041-1/+1
| | | | | Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.100.0 to 6.100.2. - [Release notes](https://github.com/HypothesisWorks/hypothesis/releases) - [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.100.0...hypothesis-python-6.100.2)
* gh-74929: Implement PEP 667 (GH-115153)Tian Gao2024-05-041-0/+1
|
* gh-111997: C-API for signalling monitoring events (#116413)Irit Katriel2024-05-041-0/+1
|
* GH-113464: Generate a more efficient JIT (GH-118512)Brandt Bucher2024-05-032-81/+142
|
* gh-117657: Disable the function/code cache in free-threaded builds (#118301)mpage2024-05-031-1/+0
| | | | This is only used by the specializing interpreter and the tier 2 optimizer, both of which are disabled in free-threaded builds.
* GH-118251: Skip fewer test in emulated JIT CI (GH-118536)Savannah Ostrowski2024-05-031-0/+79
|
* GH-118487: Add Black to `.pre-commit-config.yaml` for JIT files (GH-118537)Savannah Ostrowski2024-05-031-2/+9
|
* gh-116126: Implement PEP 696 (#116129)Jelle Zijlstra2024-05-031-0/+2
| | | | | 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/+1
| | | | | | | | | | | | | | | 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-117442: Check eval-breaker at start (rather than end) of tier 2 loops ↵Mark Shannon2024-05-021-1/+0
| | | | (GH-118482)
* gdb/libpython.py: Update PyLongObjectPtr docstring (GH-118438)Andrej2024-05-021-6/+10
|
* GH-113464: Display a warning when building the JIT (GH-118481)Brandt Bucher2024-05-016-26/+38
|