]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
7 months agogh-131178: Add tests for `tokenize` command-line interface (#131274)
Semyon Moroz [Thu, 27 Mar 2025 16:04:16 +0000 (20:04 +0400)] 
gh-131178: Add tests for `tokenize` command-line interface (#131274)

7 months agogh-131525: Cache the result of tuple_hash (#131529)
Michael Droettboom [Thu, 27 Mar 2025 13:57:06 +0000 (09:57 -0400)] 
gh-131525: Cache the result of tuple_hash (#131529)

* gh-131525: Cache the result of tuple_hash

* Fix debug builds

* Add blurb

* Fix formatting

* Pre-compute empty tuple singleton

* Mostly set the cache within tuple_alloc

* Fixes for TSAN

* Pre-compute empty tuple singleton

* Fix for 32-bit platforms

* Assert that op != NULL in _PyTuple_RESET_HASH_CACHE

* Use FT_ATOMIC_STORE_SSIZE_RELAXED macro

* Update Include/internal/pycore_tuple.h

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Fix alignment

* atomic load

* Update Objects/tupleobject.c

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
7 months agogh-118761: Always lazy import `re` in `locale` (#129860)
Semyon Moroz [Thu, 27 Mar 2025 13:47:08 +0000 (17:47 +0400)] 
gh-118761: Always lazy import `re` in `locale` (#129860)

7 months agogh-111178: Skip undefined behavior checks in _PyPegen_lookahead() (#131714)
Victor Stinner [Thu, 27 Mar 2025 09:03:58 +0000 (10:03 +0100)] 
gh-111178: Skip undefined behavior checks in _PyPegen_lookahead() (#131714)

For example, expression_rule() return type is 'expr_ty', whereas
_PyPegen_lookahead() uses 'void*'.

7 months agogh-131712: Build _suggestions extension on Windows (#131759)
Victor Stinner [Thu, 27 Mar 2025 08:53:39 +0000 (09:53 +0100)] 
gh-131712: Build _suggestions extension on Windows (#131759)

Add a test checking that the '_suggestions' extension is available.

7 months agoGH-131729: Consider in-memory state when merging storage and stack (GH-131773)
Mark Shannon [Thu, 27 Mar 2025 08:32:45 +0000 (08:32 +0000)] 
GH-131729: Consider in-memory state when merging storage and stack (GH-131773)

7 months agoRevise `pycore_stackref.h` comments. (#130601)
Neil Schemenauer [Thu, 27 Mar 2025 08:30:25 +0000 (01:30 -0700)] 
Revise `pycore_stackref.h` comments. (#130601)

7 months agogh-131782: Fix cast to match type of `bits` in `_Py_TryIncrefCompareStackRef` (#131783)
Neil Schemenauer [Thu, 27 Mar 2025 08:28:59 +0000 (01:28 -0700)] 
gh-131782: Fix cast to match type of `bits` in `_Py_TryIncrefCompareStackRef` (#131783)

7 months agogh-131763: Replace the redundant check with assert in remove_tools (#131765)
Sergey Muraviov [Wed, 26 Mar 2025 22:36:04 +0000 (01:36 +0300)] 
gh-131763: Replace the redundant check with assert in remove_tools (#131765)

7 months agogh-131236: allow to generate multiple UUIDs at once via CLI (#131218)
Simon Legner [Wed, 26 Mar 2025 20:49:28 +0000 (21:49 +0100)] 
gh-131236: allow to generate multiple UUIDs at once via CLI (#131218)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
7 months agoGH-119866: Don't clear frame->stackpointer on release builds (GH-131750)
Brandt Bucher [Wed, 26 Mar 2025 19:00:16 +0000 (12:00 -0700)] 
GH-119866: Don't clear frame->stackpointer on release builds (GH-131750)

7 months agogh-131762: Fixed dereferencing the pointer 'parser_token->metadata' with a NULL value...
rialbat [Wed, 26 Mar 2025 18:44:56 +0000 (21:44 +0300)] 
gh-131762: Fixed dereferencing the pointer 'parser_token->metadata' with a NULL value (#131764)

7 months agogh-131586: Avoid refcount contention in some "special" calls (#131588)
Sam Gross [Wed, 26 Mar 2025 18:38:47 +0000 (14:38 -0400)] 
gh-131586: Avoid refcount contention in some "special" calls (#131588)

In the free threaded build, the `_PyObject_LookupSpecial()` call can lead to
reference count contention on the returned function object becuase it
doesn't use stackrefs. Refactor some of the callers to use
`_PyObject_MaybeCallSpecialNoArgs`, which uses stackrefs internally.

This fixes the scaling bottleneck in the "lookup_special" microbenchmark
in `ftscalingbench.py`. However, the are still some uses of
`_PyObject_LookupSpecial()` that need to be addressed in future PRs.

7 months agogh-123358: Use `_PyStackRef` in `LOAD_DEREF` (gh-130064)
Sam Gross [Wed, 26 Mar 2025 16:08:20 +0000 (12:08 -0400)] 
gh-123358: Use `_PyStackRef` in `LOAD_DEREF` (gh-130064)

Concurrent accesses from multiple threads to the same `cell` object did not
scale well in the free-threaded build. Use `_PyStackRef` and optimistically
avoid locking to improve scaling.

With the locks around cell reads gone, some of the free threading tests were
prone to starvation: the readers were able to run in a tight loop and the
writer threads weren't scheduled frequently enough to make timely progress.
Adjust the tests to avoid this.

Co-authored-by: Donghee Na <donghee.na@python.org>
7 months agoGH-131729: Code-gen better liveness analysis (GH-131732)
Mark Shannon [Wed, 26 Mar 2025 15:21:35 +0000 (15:21 +0000)] 
GH-131729: Code-gen better liveness analysis (GH-131732)

* Rename 'defined' attribute to 'in_local' to more accurately reflect how it is used

* Make death of variables explicit even for array variables.

* Convert in_memory from boolean to stack offset

* Don't apply liveness analysis to optimizer generated code

* Fix RETURN_VALUE in optimizer

7 months agogh-131741: Add documentation for Windows version detection change in `platform` ...
Idan Noiman [Wed, 26 Mar 2025 14:50:37 +0000 (16:50 +0200)] 
gh-131741: Add documentation for Windows version detection change in `platform` (#131742)

Document the behavior change between 3.11 & 3.12, where ``platform`` now correctly detects Windows 11 and Windows Server releases past Windows Server 2012.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Wulian <1055917385@qq.com>
7 months agogh-131649: fix test_string_literals SyntaxWarning (#131650)
Thomas Grainger [Wed, 26 Mar 2025 14:01:18 +0000 (14:01 +0000)] 
gh-131649: fix test_string_literals SyntaxWarning (#131650)

7 months agogh-117657: Fix data race in `compare_unicode_unicode_threadsafe` (gh-131746)
Sam Gross [Wed, 26 Mar 2025 13:01:57 +0000 (09:01 -0400)] 
gh-117657: Fix data race in `compare_unicode_unicode_threadsafe` (gh-131746)

We can't safely check the type of the found key until we incref it or if we know that it's immortal.

7 months agodocument that `sys._is_gil_enabled` is CPython-specific (#131748)
Ralf Gommers [Wed, 26 Mar 2025 12:02:52 +0000 (13:02 +0100)] 
document that `sys._is_gil_enabled` is CPython-specific (#131748)

7 months agogh-130881: Handle conditionally defined annotations (#130935)
Jelle Zijlstra [Wed, 26 Mar 2025 03:48:19 +0000 (20:48 -0700)] 
gh-130881: Handle conditionally defined annotations (#130935)

7 months agogh-131740: Update PyUnstable_GC_VisitObjects to traverse perm gen (gh-131744)
Donghee Na [Wed, 26 Mar 2025 00:45:29 +0000 (09:45 +0900)] 
gh-131740: Update PyUnstable_GC_VisitObjects to traverse perm gen (gh-131744)

7 months agoGH-130673: Gracefully handle missing sections in JIT build (GH-130906)
Bojun Ren [Tue, 25 Mar 2025 23:35:39 +0000 (07:35 +0800)] 
GH-130673: Gracefully handle missing sections in JIT build (GH-130906)

7 months agoGH-131691: Fix exception handling setting for clang-cl on Windows (GH-131730)
Chris Eibl [Tue, 25 Mar 2025 23:07:52 +0000 (00:07 +0100)] 
GH-131691: Fix exception handling setting for clang-cl on Windows (GH-131730)

The /EHa option for Clang-CL behaves differently than the same option for MSVC, which is why we don't use it for both compilers.

7 months agogh-129900: Fix `SystemExit` return codes when the REPL is started from the command...
Peter Bierma [Tue, 25 Mar 2025 19:48:46 +0000 (15:48 -0400)] 
gh-129900: Fix `SystemExit` return codes when the REPL is started from the command line (#129901)

7 months agogh-131647: fix 'sys.path_hooks is empty' warning in test_importlib (#131648)
Thomas Grainger [Tue, 25 Mar 2025 17:16:15 +0000 (17:16 +0000)] 
gh-131647: fix 'sys.path_hooks is empty' warning in test_importlib (#131648)

7 months agoGH-130887: Always remove trailing jumps in AArch64 JIT stencils (GH-131042)
Diego Russo [Tue, 25 Mar 2025 17:15:36 +0000 (17:15 +0000)] 
GH-130887: Always remove trailing jumps in AArch64 JIT stencils (GH-131042)

7 months agogh-131719: add NULL pointer check to `_PyMem_FreeDelayed` (gh-131720)
Tomasz Pytel [Tue, 25 Mar 2025 14:49:18 +0000 (10:49 -0400)] 
gh-131719: add NULL pointer check to `_PyMem_FreeDelayed` (gh-131720)

7 months agogh-131711: Preventing the use of a null pointer in set_tp_mro (#131713)
Sergey Muraviov [Tue, 25 Mar 2025 13:28:38 +0000 (16:28 +0300)] 
gh-131711: Preventing the use of a null pointer in set_tp_mro (#131713)

7 months agogh-127945: fix thread safety of ctypes state (#131710)
Kumar Aditya [Tue, 25 Mar 2025 11:33:05 +0000 (17:03 +0530)] 
gh-127945: fix thread safety of ctypes state (#131710)

This fixes thread safety of `array_cache` and `swapped_suffix` by initializing them in module exec to make it thread safety.

7 months agogh-127945: add locking to malloc closure in free-threading (#131662)
Kumar Aditya [Tue, 25 Mar 2025 11:18:46 +0000 (16:48 +0530)] 
gh-127945: add locking to malloc closure in free-threading (#131662)

The freelist is not thread safe in free-threading so this adds lock around it make it thread safe in free-threading.

7 months agogh-131707: fix unawaited coroutine warning in test_coroutines.Corouti… (#131708)
Thomas Grainger [Tue, 25 Mar 2025 08:29:51 +0000 (08:29 +0000)] 
gh-131707: fix unawaited coroutine warning in test_coroutines.Corouti… (#131708)

gh-131707: fix unawaited coroutine warning in test_coroutines.CoroutineTest.test_17

7 months agogh-128446: Run Windows CI tests on each commit (#131702)
Adam Turner [Tue, 25 Mar 2025 07:06:15 +0000 (07:06 +0000)] 
gh-128446: Run Windows CI tests on each commit (#131702)

7 months agogh-131666: mark `anext_awaitable.close` as a `METH_NOARGS` instead of `METH_VARARGS...
Bénédikt Tran [Tue, 25 Mar 2025 03:33:22 +0000 (04:33 +0100)] 
gh-131666: mark `anext_awaitable.close` as a `METH_NOARGS` instead of `METH_VARARGS` (#131671)

7 months agoGH-131473: Override PreferredToolArchitecture when using Visual Studio bundled clang...
Chris Eibl [Mon, 24 Mar 2025 23:15:51 +0000 (00:15 +0100)] 
GH-131473: Override PreferredToolArchitecture when using Visual Studio bundled clang-cl (GH-131689)

tweak PreferredToolArchitecture for bundled clang-cl

7 months agogh-127146: Fix Emscripten build with --pydebug (#131672)
Hood Chatham [Mon, 24 Mar 2025 21:43:31 +0000 (22:43 +0100)] 
gh-127146: Fix Emscripten build with --pydebug (#131672)

Removes an explicit check that sysconfigdata naming is correct, in favor of reporting at
runtime with the default mechanisms.

7 months agogh-131677: Fix flaky test_lru_cache_threaded3 (gh-131679)
Sam Gross [Mon, 24 Mar 2025 20:41:50 +0000 (16:41 -0400)] 
gh-131677: Fix flaky test_lru_cache_threaded3 (gh-131679)

The call to `with self.subTest(...)` was not thread-safe.

7 months agogh-130928: Fix error message during bytes formatting for the `'i'` flag (#130967)
Ageev Maxim [Mon, 24 Mar 2025 19:07:03 +0000 (22:07 +0300)] 
gh-130928: Fix error message during bytes formatting for the `'i'` flag (#130967)

7 months agogh-131670: Fix crash in `anext()` when `__anext__` is sync and raises (#131682)
sobolevn [Mon, 24 Mar 2025 19:00:48 +0000 (22:00 +0300)] 
gh-131670: Fix crash in `anext()` when `__anext__` is sync and raises (#131682)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
7 months agogh-111178: Fix function signature in pyexpat.c (#131674)
Victor Stinner [Mon, 24 Mar 2025 17:22:45 +0000 (18:22 +0100)] 
gh-111178: Fix function signature in pyexpat.c (#131674)

Move _Py_NO_SANITIZE_UNDEFINED macro from faulthandler.c to pyport.h.

7 months agoGH-131521: Uses correct build flags for zlib-ng on Windows (GH-131526)
Chris Eibl [Mon, 24 Mar 2025 16:21:57 +0000 (17:21 +0100)] 
GH-131521: Uses correct build flags for zlib-ng on Windows (GH-131526)

Do not enable AdvancedVectorExtensions2 for all *.c files, so that the resulting binary can be executed on older CPUs, too. Also enable AdvancedVectorExtensions512 where necessary, and add the ClangCL flags required to enable vector extensions.

7 months agogh-111178: fix UBSan for example code in `extending/newtypes_tutorial` docs (GH-131606)
Bénédikt Tran [Mon, 24 Mar 2025 16:15:32 +0000 (17:15 +0100)] 
gh-111178: fix UBSan for example code in `extending/newtypes_tutorial` docs (GH-131606)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
7 months agoGH-128520: pathlib ABCs: tighten up argument types (#131621)
Barney Gale [Mon, 24 Mar 2025 15:39:08 +0000 (15:39 +0000)] 
GH-128520: pathlib ABCs: tighten up argument types (#131621)

In `JoinablePath.full_match()` and `ReadablePath.glob()`, accept a `str`
pattern argument rather than `JoinablePath | str`.

In `ReadablePath.copy()` and `copy_into()`, accept a `WritablePath` target
argument rather than `WritablePath | str`.

7 months agogh-115684: Clarify datetime `replace` documentation (#116519)
David Lowry-Duda [Mon, 24 Mar 2025 15:33:16 +0000 (11:33 -0400)] 
gh-115684: Clarify datetime `replace` documentation (#116519)

* Clarify datetime `replace` documentation

In #115684, HopedForLuck noted that `datetime.date.replace()`
documentation was confusing because it looked like it would be changing
immutable objects.

This documentation change specifies that the `replace()` methods in
`datetime` return new objects. This uses similar wording to the
documentation for `datetime.combine()`, which specifies that a new
datetime is returned. This is also similar to wording for
`string.replace()`, except `string.replace()` emphasizes that a "copy"
is returned.

Resolves #115684.

* Include reviewer comments

Thanks Privat33r-dev for the comments!

---------

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
7 months agoGH-128520: pathlib ABCs: validate `magic_open()` arguments (#131617)
Barney Gale [Mon, 24 Mar 2025 15:13:18 +0000 (15:13 +0000)] 
GH-128520: pathlib ABCs: validate `magic_open()` arguments (#131617)

When `pathlib._os.magic_open()` is called to open a path in binary mode,
raise `ValueError` if any of the *encoding*, *errors* or *newline*
arguments are given. This matches the `open()` built-in.

7 months agoGH-128520: pathlib ABCs: reject empty pattern in `ReadablePath.glob()` (#127343)
Barney Gale [Mon, 24 Mar 2025 15:12:29 +0000 (15:12 +0000)] 
GH-128520: pathlib ABCs: reject empty pattern in `ReadablePath.glob()` (#127343)

For compatibility with `Path.glob()`, raise `ValueError` if an empty
pattern is given to `ReadablePath.glob()`.

7 months agoGH-131296: Remove unused variable from _wmimodule.cpp (GH-131587)
Chris Eibl [Mon, 24 Mar 2025 14:57:07 +0000 (15:57 +0100)] 
GH-131296: Remove unused variable from _wmimodule.cpp (GH-131587)

7 months agogh-111178: Fix function signatures for test_socket (#131667)
Victor Stinner [Mon, 24 Mar 2025 14:51:32 +0000 (15:51 +0100)] 
gh-111178: Fix function signatures for test_socket (#131667)

Add unicode_fsdecode() wrapper for PyUnicode_DecodeFSDefault() to use
the correct API for Py_BuildValue() converter API.

7 months agogh-111178: fix UBSan failures for `anextawaitableobject` (#131609)
Bénédikt Tran [Mon, 24 Mar 2025 14:43:48 +0000 (15:43 +0100)] 
gh-111178: fix UBSan failures for `anextawaitableobject` (#131609)

7 months agogh-111178: Skip tests which require deep stack if UBsan (#131669)
Victor Stinner [Mon, 24 Mar 2025 14:33:56 +0000 (15:33 +0100)] 
gh-111178: Skip tests which require deep stack if UBsan (#131669)

If Python is built with Undefined Behavior sanitizer, skip
test_repr_deep() of test_userdict and test_lru_recursion() of
test_functools.

7 months agogh-111178: Fix function signatures for test_capi (#131659)
Victor Stinner [Mon, 24 Mar 2025 14:04:45 +0000 (15:04 +0100)] 
gh-111178: Fix function signatures for test_capi (#131659)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
7 months agogh-111178: Fix function signature for test_threading (#131663)
Victor Stinner [Mon, 24 Mar 2025 13:56:45 +0000 (14:56 +0100)] 
gh-111178: Fix function signature for test_threading (#131663)

7 months agogh-128421: Avoid TSAN warnings in `sys._current_frames()` (gh-131548)
Sam Gross [Mon, 24 Mar 2025 13:49:39 +0000 (09:49 -0400)] 
gh-128421: Avoid TSAN warnings in `sys._current_frames()` (gh-131548)

This tells TSAN not to sanitize `PyUnstable_InterpreterFrame_GetLine()`.
There's a possible data race on the access to the frame's `instr_ptr`
if the frame is currently executing. We don't really care about the
race. In theory, we could use relaxed atomics for every access to
`instr_ptr`, but that would create more code churn and current compilers
are overly conservative with optimizations around relaxed atomic
accesses.

We also don't sanitize `_PyFrame_IsIncomplete()` because it accesses
`instr_ptr` and is called from assertions within PyFrame_GetCode().

7 months agogh-111178: Fix function signatures for test_zoneinfo (#131664)
Victor Stinner [Mon, 24 Mar 2025 13:32:46 +0000 (14:32 +0100)] 
gh-111178: Fix function signatures for test_zoneinfo (#131664)

7 months agogh-111178: Fix function signatures for test_ctypes (#131660)
Victor Stinner [Mon, 24 Mar 2025 13:30:13 +0000 (14:30 +0100)] 
gh-111178: Fix function signatures for test_ctypes (#131660)

7 months agogh-128715: Expose ctypes.CField, with info attributes (GH-128950)
Petr Viktorin [Mon, 24 Mar 2025 13:18:34 +0000 (14:18 +0100)] 
gh-128715: Expose ctypes.CField, with info attributes (GH-128950)

- Restore max field size to sys.maxsize, as in Python 3.13 & below
- PyCField: Split out bit/byte sizes/offsets.
- Expose CField's size/offset data to Python code
- Add generic checks for all the test structs/unions, using the newly exposed attrs

7 months agogh-131311: Extract _replace_array_elements from PyCStructUnionType_update_stginfo...
Sergey Miryanov [Mon, 24 Mar 2025 12:55:09 +0000 (17:55 +0500)] 
gh-131311: Extract _replace_array_elements from PyCStructUnionType_update_stginfo (GH-131504)

7 months agogh-128485: ensure that dlmalloc initializes itself at import time in ctypes (#131633)
Kumar Aditya [Mon, 24 Mar 2025 12:44:25 +0000 (18:14 +0530)] 
gh-128485: ensure that dlmalloc initializes itself at import time in ctypes  (#131633)

7 months agogh-131311: Fix additional memory leaks in ctypes (GH-131429)
Sergey Miryanov [Mon, 24 Mar 2025 12:42:10 +0000 (17:42 +0500)] 
gh-131311: Fix additional memory leaks in ctypes (GH-131429)

* Visit keep in StructParam_traverse
* Decref swapped in PyCSimpleType_init
* Decref ob in make_funcptrtype_dict
* Check Pointer_item result while constructing result list in Pointer_subscript

* Fix align and size naming in PyCStructUnionType_update_stginfo
  - as discussed in previous PR

7 months agogh-131645: fix ResourceWarnings in `test_asyncio.test_events` (#131646)
Thomas Grainger [Mon, 24 Mar 2025 12:38:33 +0000 (12:38 +0000)] 
gh-131645: fix ResourceWarnings in `test_asyncio.test_events` (#131646)

7 months agogh-123909: Remove obsolete note in PyType_FromMetaclass docs (GH-131506)
Petr Viktorin [Mon, 24 Mar 2025 12:06:21 +0000 (13:06 +0100)] 
gh-123909: Remove obsolete note in PyType_FromMetaclass docs (GH-131506)

Docs of the other `PyType_From*` functions link to `PyType_FromMetaclass`,
which noted that they differ for backwards compatibility reasons.
The note is no longer relevant in 3.14.
The other functions have `versionchanged` blurbs.

7 months agogh-111178: fix UBSan failures for `Modules/_testcapimodule.c` (#131614)
Bénédikt Tran [Mon, 24 Mar 2025 10:14:22 +0000 (11:14 +0100)] 
gh-111178: fix UBSan failures for `Modules/_testcapimodule.c` (#131614)

Fix UBSan failures for various classes in `Modules/_testcapimodule.c`,
remove some redundant casts and add some `Py_UNUSED()` usages.

7 months agogh-111178: fix UBSan failures for `Modules/_testcapi/{buffer,monitoring}.c` (#131613)
Bénédikt Tran [Mon, 24 Mar 2025 10:06:37 +0000 (11:06 +0100)] 
gh-111178: fix UBSan failures for `Modules/_testcapi/{buffer,monitoring}.c` (#131613)

7 months agogh-111178: fix UBSan failures for `PyBytesObject` (#131603)
Bénédikt Tran [Mon, 24 Mar 2025 10:02:09 +0000 (11:02 +0100)] 
gh-111178: fix UBSan failures for `PyBytesObject` (#131603)

7 months agogh-111178: fix UBSan failures for `Python/legacy_tracing.c` (#131611)
Bénédikt Tran [Mon, 24 Mar 2025 10:00:32 +0000 (11:00 +0100)] 
gh-111178: fix UBSan failures for `Python/legacy_tracing.c` (#131611)

7 months agogh-111178: fix UBSan failures for `Modules/_testmultiphase.c` (#131615)
Bénédikt Tran [Mon, 24 Mar 2025 09:59:30 +0000 (10:59 +0100)] 
gh-111178: fix UBSan failures for `Modules/_testmultiphase.c` (#131615)

7 months agogh-111178: fix UBSan failures for `Python/instrumentation.c` (#131608)
Bénédikt Tran [Mon, 24 Mar 2025 09:58:33 +0000 (10:58 +0100)] 
gh-111178: fix UBSan failures for `Python/instrumentation.c` (#131608)

7 months agogh-111178: fix UBSan failures for `PyStdPrinter_Object` (#131607)
Bénédikt Tran [Mon, 24 Mar 2025 09:57:14 +0000 (10:57 +0100)] 
gh-111178: fix UBSan failures for `PyStdPrinter_Object` (#131607)

7 months agogh-111178: fix UBSan failures for `_PyExecutorObject` (#131610)
Bénédikt Tran [Mon, 24 Mar 2025 09:53:23 +0000 (10:53 +0100)] 
gh-111178: fix UBSan failures for `_PyExecutorObject` (#131610)

7 months agogh-111178: fix UBSan failures for `PyBufferWrapper` (#131616)
Bénédikt Tran [Mon, 24 Mar 2025 09:52:52 +0000 (10:52 +0100)] 
gh-111178: fix UBSan failures for `PyBufferWrapper` (#131616)

7 months agogh-111178: fix UBSan failures for `Modules/_testbuffer.c` (#131612)
Bénédikt Tran [Mon, 24 Mar 2025 09:46:25 +0000 (10:46 +0100)] 
gh-111178: fix UBSan failures for `Modules/_testbuffer.c` (#131612)

7 months agogh-111178: fix UBSan failures for `TaskStepMethWrapper` (#131602)
Bénédikt Tran [Sun, 23 Mar 2025 14:26:03 +0000 (15:26 +0100)] 
gh-111178: fix UBSan failures for `TaskStepMethWrapper` (#131602)

7 months agono-issue: Fix typo in importlib.metadata.rst (gh-131596)
Zsolt Dollenstein [Sun, 23 Mar 2025 14:01:29 +0000 (14:01 +0000)] 
no-issue: Fix typo in importlib.metadata.rst (gh-131596)

7 months agogh-130080: do not fold match case constants in unoptimized AST (#131577)
Irit Katriel [Sun, 23 Mar 2025 13:50:14 +0000 (13:50 +0000)] 
gh-130080: do not fold match case constants in unoptimized AST (#131577)

7 months agogh-130283: update deprecated links and examples in `urllib.request` docs (#130284)
Kanishk Pachauri [Sun, 23 Mar 2025 13:29:29 +0000 (13:29 +0000)] 
gh-130283: update deprecated links and examples in `urllib.request` docs (#130284)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
7 months agogh-121529: Document `from_` parameter in `_mboxMMDF` public methods (#121530)
Sebb [Sun, 23 Mar 2025 12:10:47 +0000 (12:10 +0000)] 
gh-121529: Document `from_` parameter in `_mboxMMDF` public methods (#121530)

7 months agogh-131418: remove unused legacy typedefs in `{md5,sha1}module.c` (#131420)
Bénédikt Tran [Sun, 23 Mar 2025 11:19:26 +0000 (12:19 +0100)] 
gh-131418: remove unused legacy typedefs in `{md5,sha1}module.c` (#131420)

- Remove legacy typedefs `MD5_INT32` and `MD5_INT64` in `Modules/md5module.c`
- Remove legacy typedefs `SHA1_INT32` and `SHA1_INT64` in `Modules/sha1module.c`.

Those legacy typedefs were used to detect whether the host platform could
correctly implement MD5 and SHA-1, but this is no longer needed as we now
fallback to HACL* implementations.

7 months agogh-131357: Add a set of asserts to test.test_capi.test_bytearray (#131554)
Nybblista [Sun, 23 Mar 2025 07:20:40 +0000 (10:20 +0300)] 
gh-131357: Add a set of asserts to test.test_capi.test_bytearray (#131554)

add a set of asserts to test.test_capi.test_bytearray

1. Assert empty bytearray object for PyByteArray_Check.
2. Assert empty bytearray object for PyByteArray_CheckExact.
3. Assert 0-size bytearray object for PyByteArray_Size.
4. Assert empty bytearray object for PyByteArray_AsString.
5. Assert concatenation of the bytearray object with itself for PyByteArray_Concat.

7 months agoGH-131296: fix clang-cl warning on Windows in semaphore.c (GH-131595)
Chris Eibl [Sat, 22 Mar 2025 22:44:56 +0000 (23:44 +0100)] 
GH-131296: fix clang-cl warning on Windows in semaphore.c (GH-131595)

fix clangcl warning

7 months agogh-131566: Skip `test_tracemalloc_track_race` under TSAN (gh-131567)
Sam Gross [Sat, 22 Mar 2025 15:46:36 +0000 (11:46 -0400)] 
gh-131566: Skip `test_tracemalloc_track_race` under TSAN (gh-131567)

The test has data race when setting the global "raw" memory allocator.

7 months agogh-131296: fix clang-cl warning in tracemalloc.c (#131514)
Victor Stinner [Sat, 22 Mar 2025 09:38:47 +0000 (10:38 +0100)] 
gh-131296: fix clang-cl warning in tracemalloc.c (#131514)

Always set MAX_NFRAME to UINT16_MAX.

Avoid the complicated code which emitted a compiler warning.

7 months agogh-131457: Fix typo in BNF description of function signatures (#131460)
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) [Sat, 22 Mar 2025 07:54:48 +0000 (13:24 +0530)] 
gh-131457: Fix typo in BNF description of function signatures (#131460)

7 months agogh-131238: Add missing pycore_function.h includes for JIT compiler (#131571)
Victor Stinner [Fri, 21 Mar 2025 23:37:49 +0000 (00:37 +0100)] 
gh-131238: Add missing pycore_function.h includes for JIT compiler (#131571)

7 months agogh-130312: SET_ADD should not lock (#130136)
Dino Viehland [Fri, 21 Mar 2025 22:58:32 +0000 (15:58 -0700)] 
gh-130312: SET_ADD should not lock (#130136)

SET_ADD should not lock

7 months agogh-131238: Move _Py_VISIT_STACKREF() to pycore_stackref.h (#131560)
Victor Stinner [Fri, 21 Mar 2025 22:24:14 +0000 (23:24 +0100)] 
gh-131238: Move _Py_VISIT_STACKREF() to pycore_stackref.h (#131560)

* Move _Py_VISIT_STACKREF() from pycore_gc.h to pycore_stackref.h.
* Remove pycore_interpframe.h include from pycore_genobject.h.
* Remove now useless includes from C files.
* Add pycore_interpframe_structs.h to Makefile.pre.in and
  pythoncore.vcxproj.

7 months agoGH-128520: pathlib ABCs: allow tests to be run externally (#131315)
Barney Gale [Fri, 21 Mar 2025 22:18:20 +0000 (22:18 +0000)] 
GH-128520: pathlib ABCs: allow tests to be run externally (#131315)

Adjust the tests for the `pathlib.types` module so that they can be run
against the `pathlib-abc` PyPI package, which is a backport of the module
for older Python versions.

Specifically, we add a `.support.is_pypi` switch that is false in the
stdlib and true in the pathlib-abc package. This controls which package
we import, and whether or not we run tests against `PurePath` and `Path`.

For compatibility with older Python versions, we stop using
`zipfile.ZipFile.mkdir()` and `zipfile.ZipInfo._for_archive()`.

7 months agogh-117657: Skip some tests when running with TSAN (gh-131555)
Sam Gross [Fri, 21 Mar 2025 19:16:08 +0000 (15:16 -0400)] 
gh-117657: Skip some tests when running with TSAN (gh-131555)

The subinterpreter tests have data races (see gh-129824).

TSAN attempts to intercept some of the fatal signals, which can lead to
bogus reports. We could possibly handle these via TSAN_OPTIONS, but it's
simpler to just skip those tests -- they're not multithreaded anyways.

7 months agoGH-130415: Optimize constant comparison in JIT builds (GH-131489)
Savannah Ostrowski [Fri, 21 Mar 2025 18:23:12 +0000 (11:23 -0700)] 
GH-130415: Optimize constant comparison in JIT builds (GH-131489)

7 months agogh-117657: Fix TSAN data race in _PyEval_SetTrace assertion (gh-131561)
Sam Gross [Fri, 21 Mar 2025 18:22:37 +0000 (14:22 -0400)] 
gh-117657: Fix TSAN data race in _PyEval_SetTrace assertion (gh-131561)

The `sys_tracing_threads` variable should be read inside `LOCK_SETUP()`.

7 months agogh-131233: remove return-in-finally in multiprocessing/connection.py (#131416)
Irit Katriel [Fri, 21 Mar 2025 18:05:47 +0000 (18:05 +0000)] 
gh-131233: remove return-in-finally in multiprocessing/connection.py (#131416)

7 months agogh-131507: Refactor screen and cursor position calculations (GH-131547)
Łukasz Langa [Fri, 21 Mar 2025 17:27:35 +0000 (18:27 +0100)] 
gh-131507: Refactor screen and cursor position calculations (GH-131547)

This is based off #131509.

7 months agogh-131238: Add pycore_interpframe_structs.h header (#131553)
Victor Stinner [Fri, 21 Mar 2025 17:19:47 +0000 (18:19 +0100)] 
gh-131238: Add pycore_interpframe_structs.h header (#131553)

Add an explicit include to pycore_interpframe_structs.h in
pycore_runtime_structs.h to fix a dependency cycle.

7 months agogh-131238: Remove pycore_object_deferred.h from pycore_object.h (#131549)
Victor Stinner [Fri, 21 Mar 2025 16:44:10 +0000 (17:44 +0100)] 
gh-131238: Remove pycore_object_deferred.h from pycore_object.h (#131549)

Remove also pycore_function.h from pycore_typeobject.h.

7 months agogh-131238: Add pycore_interpframe.h to PYTHON_HEADERS (#131545)
Victor Stinner [Fri, 21 Mar 2025 15:24:15 +0000 (16:24 +0100)] 
gh-131238: Add pycore_interpframe.h to PYTHON_HEADERS (#131545)

Add pycore_interpframe.h to Makefile.pre.in and pythoncore.vcxproj.

7 months agogh-128421: Add locking to most frame object functions (gh-131479)
Sam Gross [Fri, 21 Mar 2025 15:10:07 +0000 (11:10 -0400)] 
gh-128421: Add locking to most frame object functions (gh-131479)

This makes more operations on frame objects thread-safe in the free
threaded build, which fixes some data races that occurred when passing
exceptions between threads.

However, accessing local variables from another thread while its running
is still not thread-safe and may crash the interpreter.

7 months agogh-131507: Clean up tests and type checking for `_pyrepl` (#131509)
Łukasz Langa [Fri, 21 Mar 2025 14:48:10 +0000 (15:48 +0100)] 
gh-131507: Clean up tests and type checking for `_pyrepl` (#131509)

7 months agoGH-131513: Cases generator: Allow dead inputs to be reassigned (GH-131515)
Mark Shannon [Fri, 21 Mar 2025 11:38:17 +0000 (11:38 +0000)] 
GH-131513: Cases generator: Allow dead inputs to be reassigned (GH-131515)

7 months agogh-131268: Implement thread names on OpenBSD (#131528)
Xavier G. [Fri, 21 Mar 2025 10:12:35 +0000 (11:12 +0100)] 
gh-131268: Implement thread names on OpenBSD (#131528)

7 months agogh-70647: Raise a more informative error for when date is out of range (GH-131335)
Stan Ulbrych [Fri, 21 Mar 2025 03:47:09 +0000 (03:47 +0000)] 
gh-70647: Raise a more informative error for when date is out of range (GH-131335)

More informative error messages mean less debugging what went wrong.

7 months agogh-120144: Disable the CALL event when possible to achieve zero overhead pdb (#131390)
Tian Gao [Fri, 21 Mar 2025 00:31:55 +0000 (20:31 -0400)] 
gh-120144: Disable the CALL event when possible to achieve zero overhead pdb (#131390)

7 months agoGH-131331: Rename "not" to "invert" (GH-131334)
Bénédikt Tran [Thu, 20 Mar 2025 23:59:41 +0000 (00:59 +0100)] 
GH-131331: Rename "not" to "invert" (GH-131334)