Commit Graph

4374 Commits

Author SHA1 Message Date
Miss Islington (bot) ad944b5e1f
[3.13] gh-123700: Update OpenSSL versions in multissltests and CI (GH-123702)
Remove EOL 1.1.1w from CI and move it to the 'old' set in multissltests,
add latest 3.3.2 to both CI and multissltests.

(cherry picked from commit d83e30cadd)

Co-authored-by: Zachary Ware <zach@python.org>
2024-09-04 16:31:01 -05:00
Miss Islington (bot) e3b4564f6c
[3.13] gh-123418: Update CI to use fresh OpenSSL releases (GH-123696)
Also adds openssl/openssl GitHub URL template for newer OpenSSL downloads
(cherry picked from commit 56b00f4705)

Co-authored-by: Zachary Ware <zach@python.org>
2024-09-04 14:33:56 -05:00
Miss Islington (bot) f8124237e7
[3.13] gh-123458: Skip SBOM generation if no git repository is detected (GH-123507) (#123616)
gh-123458: Skip SBOM generation if no git repository is detected (GH-123507)
(cherry picked from commit db42934270)

Co-authored-by: Seth Michael Larson <seth@python.org>
2024-09-03 01:15:48 +02:00
Hugo van Kemenade 7b453ad74e
[3.13] build(deps): bump hypothesis from 6.108.10 to 6.111.2 in /Tools (GH-123567) (#123591)
(cherry picked from commit 88210c295d)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-02 13:20:09 +02:00
Serhiy Storchaka 8b6dd92db7
[3.13] gh-122688: Fix support of var-positional parameter in Argument Clinic (GH-122689) (#122852)
* Parameters after the var-positional parameter are now keyword-only
  instead of positional-or-keyword.
* Correctly calculate min_kw_only.
* Raise errors for invalid combinations of the var-positional parameter
  with "*", "/" and deprecation markers.
(cherry picked from commit 8393608dd9)
2024-09-02 13:03:04 +02:00
Miss Islington (bot) 5148e03f0f
[3.13] GH-121723: Skip test_config_queue_handler_multiprocessing_context in emulated JIT CI (GH-122991)
(cherry picked from commit 7b8328b6b3)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-08-22 13:16:52 -07:00
Miss Islington (bot) 27a5292774
[3.13] GH-118943: Handle races when moving jit_stencils.h (GH-122709)
(cherry picked from commit 44659d3927)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-08-08 13:37:49 -07:00
Miss Islington (bot) 35bf9c62b1
[3.13] Fix syntax in generate_re_casefix.py (GH-122699) (#122721)
This was broken in gh-97963.
(cherry picked from commit b72c748d7f)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-08-06 06:46:14 +00:00
Miss Islington (bot) 8e96d85386
[3.13] gh-117657: Avoid race in `PAUSE_ADAPTIVE_COUNTER` in free-threaded build (GH-122190) (#122475)
The adaptive counter doesn't do anything currently in the free-threaded
build and TSan reports a data race due to concurrent modifications to
the counter.
(cherry picked from commit 2b163aa9e7)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-30 18:18:25 +00:00
Miss Islington (bot) e122d2adfa
[3.13] gh-122044: Don't error during gitignore filtering with no files (GH-122045) (#122355)
Co-authored-by: Seth Michael Larson <seth@python.org>
2024-07-27 14:34:08 +00:00
Miss Islington (bot) 9d5dde5006
[3.13] gh-122201: Lock mutex when setting handling_thread to NULL (GH-122204) (#122319)
In the free-threaded build, we need to lock pending->mutex when clearing
the handling_thread in order not to race with a concurrent
make_pending_calls in the same interpreter.
(cherry picked from commit c557ae97d6)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-26 17:30:08 +00:00
Mark Shannon 9162da254a
[3.13] GH-122155: Fix cases generator to correctly compute 'peek' offset for error handling (GH-122158) (GH-122174) 2024-07-26 10:51:42 +01:00
Miss Islington (bot) 83bfc5bd8b
[3.13] gh-122270: Fix typos in the Py_DEBUG macro name (GH-122271) (GH-122275)
(cherry picked from commit 6c09b8de5c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-07-25 11:29:22 +00:00
Adam Turner c12f81ed82
[3.13] GH-121970: Rewrite the C-API annotations extension (#121985) (#122027)
GH-121970: Rewrite the C-API annotations extension (#121985)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
(cherry picked from commit 22c9d9c1fc)
2024-07-19 13:03:52 +00:00
Miss Islington (bot) a12c105908
[3.13] Add note about PYTHON_JIT environment variable to JIT README (GH-121942)
(cherry picked from commit f113c1a2a9)
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
2024-07-17 22:18:39 +00:00
Miss Islington (bot) 2e34591f1b
[3.13] GH-120371: Add WASI SDK 22 support (GH-121870) (GH-121873)
GH-120371: Add WASI SDK 22 support (GH-121870)

Required disabling stub functions now provided by wasi-libc.
(cherry picked from commit f589f263bc)

Co-authored-by: Brett Cannon <brett@python.org>
2024-07-16 14:49:55 -07:00
Miss Islington (bot) 85e9018a01
[3.13] gh-117657: Remove TSAN suppressions for _abc.c (GH-121508) (#121598)
The functions look thread-safe and I haven't seen any warnings issued
when running the tests locally.
(cherry picked from commit 7641743d48)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-10 21:34:14 +00:00
Miss Islington (bot) 927f882d76
[3.13] gh-117657: Fix TSan race in _PyDict_CheckConsistency (GH-121551) (#121590)
The only remaining race in dictobject.c was in _PyDict_CheckConsistency
when the dictionary has shared keys.
(cherry picked from commit 3ec719fabf)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-10 18:28:44 +00:00
Miss Islington (bot) 3824dc9fa3
[3.13] GH-121521: Detect when wasmtime is not installed in `Tools/wasm/wasi.py` (GH-121522) (GH-121558)
GH-121521: Detect when wasmtime is not installed in `Tools/wasm/wasi.py` (GH-121522)
(cherry picked from commit f62161837e)

Co-authored-by: Brett Cannon <brett@python.org>
2024-07-09 22:31:39 +00:00
Miss Islington (bot) f0d16f7e82
[3.13] gh-117657: Fix TSAN races in setobject.c (GH-121511) (#121541)
The `used` field must be written using atomic stores because `set_len`
and iterators may access the field concurrently without holding the
per-object lock.
(cherry picked from commit 9c08f40a61)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-09 16:36:36 +00:00
Miss Islington (bot) 06fd745dd9
[3.13] gh-117657: Fix data races reported by TSAN in some set methods (GH-120914) (#121240)
Refactor the fast Unicode hash check into `_PyObject_HashFast` and use relaxed
atomic loads in the free-threaded build.

After this change, the TSAN doesn't report data races for this method.
(cherry picked from commit 294e724964)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2024-07-01 19:40:28 +00:00
Miss Islington (bot) 7db14f1eba
[3.13] Ignore some failing tests in emulated JIT CI (GH-120977)
(cherry picked from commit 07daaf1ce1)
Co-authored-by: Diego Russo <diego.russo@arm.com>
2024-06-26 06:56:15 -07:00
Petr Viktorin 9769b7ae06
[3.13] gh-113993: Allow interned strings to be mortal, and fix related 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>
2024-06-24 20:24:19 +02:00
Miss Islington (bot) 6b714d545f
[3.13] GH-120602: Support LLVM_VERSION_SUFFIX for JIT builds (GH-120768)
(cherry picked from commit 285f42c850)

Co-authored-by: Xarblu <xarblu@protonmail.com>
2024-06-20 01:13:23 +00:00
Miss Islington (bot) 396f8b0b98
[3.13] gh-117657: Fix `__slots__` thread safety in free-threaded build (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 362cd2680b)

Co-authored-by: Daniele Parmeggiani <8658291+dpdani@users.noreply.github.com>
2024-06-17 19:12:25 +00:00
Miss Islington (bot) 0dbb86c5be
[3.13] gh-117657: Fix TSan reported data race on ioctl_works (GH-120175) (#120654)
(cherry picked from commit 460cc9e14e)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-06-17 17:52:49 +00:00
Miss Islington (bot) f7ba3233a2
[3.13] gh-120433: Mention ``chocolatey`` for installing llvm on Windows as 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 95737bbf18)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-06-17 19:18:07 +03:00
Miss Islington (bot) 6e3e112428
[3.13] gh-117657: Add TSAN suppression for set_default_allocator_unlocked (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 2bacc2343c)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2024-06-14 16:34:07 +00:00
Miss Islington (bot) 3067c62a34
[3.13] gh-117657: Make PyType_HasFeature atomic (GH-120210) (#120443)
gh-117657: Make PyType_HasFeature atomic (GH-120210)

Make PyType_HasFeature atomic
(cherry picked from commit eebae2c460)

Co-authored-by: Ken Jin <kenjin@python.org>
2024-06-13 18:06:04 +08:00
Miss Islington (bot) 0041087aa1
[3.13] gh-71587: Drop local reference cache to `_strptime` module in `_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 127c1d2771, AKA gh-120224)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2024-06-12 17:15:16 +00:00
Miss Islington (bot) 91c4444d22
[3.13] gh-117657: Make Py_TYPE and Py_SET_TYPE thread safe (GH-120165) (GH-120403)
gh-117657: Make Py_TYPE and Py_SET_TYPE thread safe (GH-120165)
(cherry picked from commit e16aed63f6)

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>
2024-06-12 21:37:26 +08:00
Miss Islington (bot) 517733ce3c
[3.13] gh-117657: Fix TSAN race involving import lock (GH-118523) (#120169)
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 e21057b999)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-06-06 18:03:01 +00:00
Miss Islington (bot) ee7d2681f6
[3.13] gh-117657: Fix race involving GC and heap initialization (GH-119923) (#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 e69d068ad0)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-06-04 14:08:10 +00:00
Miss Islington (bot) e5fb3a2385
[3.13] gh-117398: Use Per-Interpreter State for the _datetime Static Types (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 105f22ea46, AKA gh-119929)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-06-03 23:37:28 +00:00
Sam Gross 79fae3b0a1
[3.13] gh-117657: Fix itertools.count thread safety (GH-119268) (#120007)
Fix itertools.count in free-threading mode
(cherry picked from commit 87939bd579)

Co-authored-by: Arnon Yaari <wiggin15@yahoo.com>
2024-06-03 22:47:34 +00:00
Sam Gross ae705319fc
[3.13] gh-117657: Fix race involving immortalizing objects (GH-119927) (#120005)
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 47fb4327b5)
2024-06-03 22:21:32 +00:00
Miss Islington (bot) ca37034baa
[3.13] gh-117657: Avoid `sem_clockwait` in TSAN (GH-119915) (#119992)
The `sem_clockwait` function is not currently instrumented, which leads
to false positives.
(cherry picked from commit 41c1cefbae)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-06-03 18:07:22 +00:00
Miss Islington (bot) 671b740f45
gh-119679: Ensures correct import libraries are included in Windows install packages (GH-119790)
(cherry picked from commit fd01271366)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-06-03 15:06:53 +00:00
Miss Islington (bot) e5dfcea3e3
[3.13] gh-117657: Fix data races report by TSAN unicode-hash (gh-119907) (gh-119963)
gh-117657: Fix data races report by TSAN unicode-hash (gh-119907)
(cherry picked from commit 0594a27e5f)

Co-authored-by: Donghee Na <donghee.na@python.org>
2024-06-03 03:45:44 +00:00
Miss Islington (bot) 9d3de7b0ed
[3.13] gh-117657: Fix TSAN reported race in `_PyEval_IsGILEnabled`. (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 f3b89a63cb)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-06-02 14:42:46 +00:00
Miss Islington (bot) 9f9be95d66
[3.13] gh-117657: Add TSAN suppression for `set_discard_entry` (GH-119908) (#119914)
Seen in CI occasionally when running `test_weakref`.
(cherry picked from commit 7dc745d1f5)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-06-01 16:42:16 +00:00
Miss Islington (bot) 48054d2306
[3.13] gh-117657: Fix TSAN race in QSBR assertion (GH-119887) (#119904)
Due to a limitation in TSAN, all reads from `PyThreadState.state` must be
atomic to avoid reported races.
(cherry picked from commit 90ec19fd33)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-06-01 14:51:55 +00:00
Miss Islington (bot) 48f3378d6c
[3.13] gh-117657: Fix TSAN race in free-threaded GC (GH-119883) (#119903)
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 60593b2052)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-06-01 14:26:12 +00:00
Miss Islington (bot) 7dae73b21b
[3.13] gh-97747: Improvements to WASM browser REPL. (GH-97665) (GH-119828)
(cherry picked from commit 010aaa32fb)

Co-authored-by: Katie Bell <katie@katharos.id.au>
2024-05-31 11:25:39 +02:00
Victor Stinner 48c7776883
[3.13] gh-119661: Add _Py_SINGLETON() include in Argumenet Clinic (#119712) (#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 7ca74a760a)
2024-05-29 10:32:00 +00:00
Eric Snow 12a580b82d
[3.13] gh-117398: Statically Allocate the Datetime C-API (GH-119472) (gh-119641)
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)
2024-05-28 21:00:04 +00:00
Miss Islington (bot) 3e30a38561
gh-117505: Run ensurepip in isolated env in Windows installer (GH-118257)
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 c9073eb1a9)

Co-authored-by: Michael Vincent <377567+Vynce@users.noreply.github.com>
2024-05-22 19:46:35 +00:00
Miss Islington (bot) bfd9c3ea53
[3.13] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across 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 81865002ae)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-05-22 12:09:48 -06:00
Miss Islington (bot) d8c562af55
[3.13] gh-112844: Update CPE references for external dependencies (GH-118521) (#119237)
Co-authored-by: Seth Michael Larson <seth@python.org>
2024-05-20 13:32:38 -06:00
Miss Islington (bot) acffe20683
[3.13] GH-118943: Fix a race condition when generating jit_stencils.h (GH-119101)
(cherry picked from commit 4702b7b5bd)
2024-05-16 14:37:56 -04:00