]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
20 months agogh-110850: Rename internal PyTime C API functions (#115734)
Victor Stinner [Tue, 20 Feb 2024 22:16:37 +0000 (23:16 +0100)] 
gh-110850: Rename internal PyTime C API functions (#115734)

Rename functions:

* _PyTime_GetSystemClock() => _PyTime_TimeUnchecked()
* _PyTime_GetPerfCounter() => _PyTime_PerfCounterUnchecked()
* _PyTime_GetMonotonicClock() => _PyTime_MonotonicUnchecked()
* _PyTime_GetSystemClockWithInfo() => _PyTime_TimeWithInfo()
* _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo()
* _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo()

Changes:

* Remove "typedef PyTime_t PyTime_t;" which was
  "typedef PyTime_t _PyTime_t;" before a previous rename.
* Update comments of "Unchecked" functions.
* Remove invalid PyTime_Time() comment.

20 months agogh-104061: Add socket.SO_BINDTOIFINDEX constant (GH-104062)
Victor Westerhuis [Tue, 20 Feb 2024 21:08:15 +0000 (22:08 +0100)] 
gh-104061: Add socket.SO_BINDTOIFINDEX constant (GH-104062)

Add socket.SO_BINDTOIFINDEX constant

This socket option avoids a race condition between SO_BINDTODEVICE and network interface renaming.

20 months agoTier 2 cleanups and tweaks (#115534)
Guido van Rossum [Tue, 20 Feb 2024 20:24:35 +0000 (12:24 -0800)] 
Tier 2 cleanups and tweaks (#115534)

* Rename `_testinternalcapi.get_{uop,counter}_optimizer` to `new_*_optimizer`
* Use `_PyUOpName()` instead of` _PyOpcode_uop_name[]`
* Add `target` to executor iterator items -- `list(ex)` now returns `(opcode, oparg, target, operand)` quadruples
* Add executor methods `get_opcode()` and `get_oparg()` to get `vmdata.opcode`, `vmdata.oparg`
* Define a helper for printing uops, and unify various places where they are printed
* Add a hack to summarize_stats.py to fix legacy uop names (e.g. `POP_TOP` -> `_POP_TOP`)
* Define helpers in `test_opt.py` for accessing the set or list of opnames of an executor

20 months agogh-115733: Fix crash involving exhausted list iterator (#115740)
Sam Gross [Tue, 20 Feb 2024 20:18:44 +0000 (15:18 -0500)] 
gh-115733: Fix crash involving exhausted list iterator (#115740)

* gh-115733: Fix crash involving exhausted iterator

* Add blurb

20 months agoGH-115727: Temporary fix of confidence score test. (GH-115728)
Mark Shannon [Tue, 20 Feb 2024 18:50:31 +0000 (18:50 +0000)] 
GH-115727: Temporary fix of confidence score test. (GH-115728)

Temporary fix of confidence score test.

20 months agogh-115735: Fix current executor NULL before _START_EXECUTOR (#115736)
Ken Jin [Tue, 20 Feb 2024 18:47:05 +0000 (02:47 +0800)] 
gh-115735: Fix current executor NULL before _START_EXECUTOR (#115736)

This fixes level 3 or higher lltrace debug output `--with-pydebug` runs.

20 months agogh-115103: Implement delayed free mechanism for free-threaded builds (#115367)
Sam Gross [Tue, 20 Feb 2024 18:04:37 +0000 (13:04 -0500)] 
gh-115103: Implement delayed free mechanism for free-threaded builds (#115367)

This adds `_PyMem_FreeDelayed()` and supporting functions. The
`_PyMem_FreeDelayed()` function frees memory with the same allocator as
`PyMem_Free()`, but after some delay to ensure that concurrent lock-free
readers have finished.

20 months agogh-110850: Cleanup pycore_time.h includes (#115724)
Victor Stinner [Tue, 20 Feb 2024 16:50:43 +0000 (17:50 +0100)] 
gh-110850: Cleanup pycore_time.h includes (#115724)

<pycore_time.h> include is no longer needed to get the PyTime_t type
in internal header files. This type is now provided by <Python.h>
include. Add <pycore_time.h> includes to C files instead.

20 months agogh-86291: linecache: get module name from __spec__ if available (GH-22908)
Eugene Toder [Tue, 20 Feb 2024 16:47:41 +0000 (11:47 -0500)] 
gh-86291: linecache: get module name from __spec__ if available (GH-22908)

This allows getting source code for the __main__ module when a custom
loader is used.

20 months agogh-115712: Support CSV dialects with delimiter=' ' and skipinitialspace=True (GH...
Serhiy Storchaka [Tue, 20 Feb 2024 16:09:50 +0000 (18:09 +0200)] 
gh-115712: Support CSV dialects with delimiter=' ' and skipinitialspace=True (GH-115721)

Restore support of such combination, disabled in gh-113796.

csv.writer() now quotes empty fields if delimiter is a space and
skipinitialspace is true and raises exception if quoting is not possible.

20 months agogh-115491: Keep some fields valid across allocations (free-threading) (#115573)
Sam Gross [Tue, 20 Feb 2024 15:36:40 +0000 (10:36 -0500)] 
gh-115491: Keep some fields valid across allocations (free-threading) (#115573)

This avoids filling the memory occupied by ob_tid, ob_ref_local, and
ob_ref_shared with debug bytes (e.g., 0xDD) in mimalloc in the
free-threaded build.

20 months agogh-101860: Expose __name__ on property (GH-101876)
Eugene Toder [Tue, 20 Feb 2024 15:14:34 +0000 (10:14 -0500)] 
gh-101860: Expose __name__ on property (GH-101876)

Useful for introspection and consistent with functions and other
descriptors.

20 months agogh-110850: Replace _PyTime_t with PyTime_t (#115719)
Victor Stinner [Tue, 20 Feb 2024 15:02:27 +0000 (16:02 +0100)] 
gh-110850: Replace _PyTime_t with PyTime_t (#115719)

Run command:

sed -i -e 's!\<_PyTime_t\>!PyTime_t!g' $(find -name "*.c" -o -name "*.h")

20 months agogh-112175: Add `eval_breaker` to `PyThreadState` (#115194)
Brett Simmers [Tue, 20 Feb 2024 14:57:48 +0000 (06:57 -0800)] 
gh-112175: Add `eval_breaker` to `PyThreadState` (#115194)

This change adds an `eval_breaker` field to `PyThreadState`. The primary
motivation is for performance in free-threaded builds: with thread-local eval
breakers, we can stop a specific thread (e.g., for an async exception) without
interrupting other threads.

The source of truth for the global instrumentation version is stored in the
`instrumentation_version` field in PyInterpreterState. Threads usually read the
version from their local `eval_breaker`, where it continues to be colocated
with the eval breaker bits.

20 months agogh-112020: Document the meaning of empty bytes returned by socket.recv() (GH-112055)
talcs [Tue, 20 Feb 2024 14:54:33 +0000 (16:54 +0200)] 
gh-112020: Document the meaning of empty bytes returned by socket.recv() (GH-112055)

20 months agogh-110850: Enhance PyTime C API tests (#115715)
Victor Stinner [Tue, 20 Feb 2024 14:53:40 +0000 (15:53 +0100)] 
gh-110850: Enhance PyTime C API tests (#115715)

20 months agoAdd missed `stream` argument (#111775)
Alexander Shadchin [Tue, 20 Feb 2024 14:09:46 +0000 (17:09 +0300)] 
Add missed `stream` argument (#111775)

* Add missed `stream` argument

* Add news

20 months agogh-110850: PyTime_Time() return 0 on success (GH-115713)
Victor Stinner [Tue, 20 Feb 2024 13:35:41 +0000 (14:35 +0100)] 
gh-110850: PyTime_Time() return 0 on success (GH-115713)

Thanks!

20 months agogh-115687: Split up guards from COMPARE_OP (GH-115688)
Ken Jin [Tue, 20 Feb 2024 11:30:49 +0000 (19:30 +0800)] 
gh-115687: Split up guards from COMPARE_OP (GH-115688)

20 months agogh-115700: Add target `_RegenCases` in Windows build for cases regeneration. (GH...
Kirill Podoprigora [Tue, 20 Feb 2024 11:10:47 +0000 (14:10 +0300)] 
gh-115700: Add target `_RegenCases` in Windows build for cases regeneration. (GH-115708)

20 months agoGH-115457: Support splitting and replication of micro ops. (GH-115558)
Mark Shannon [Tue, 20 Feb 2024 10:50:59 +0000 (10:50 +0000)] 
GH-115457: Support splitting and replication of micro ops.  (GH-115558)

20 months agoGH-112354: Initial implementation of warm up on exits and trace-stitching (GH-114142)
Mark Shannon [Tue, 20 Feb 2024 09:39:55 +0000 (09:39 +0000)] 
GH-112354: Initial implementation of warm up on exits and trace-stitching (GH-114142)

20 months agogh-113157: Document and test __get__ for MethodType (gh-115492)
Raymond Hettinger [Tue, 20 Feb 2024 07:53:25 +0000 (01:53 -0600)] 
gh-113157: Document and test __get__ for MethodType (gh-115492)

20 months agoMake the title match the content (GH-115702)
Raymond Hettinger [Tue, 20 Feb 2024 07:51:56 +0000 (01:51 -0600)] 
Make the title match the content (GH-115702)

20 months agoModernize the Sorting HowTo guide (gh-115479)
Raymond Hettinger [Tue, 20 Feb 2024 03:22:07 +0000 (21:22 -0600)] 
Modernize the Sorting HowTo guide (gh-115479)

20 months agogh-115539: Allow enum.Flag to have None members (GH-115636)
Jason Zhang [Mon, 19 Feb 2024 22:36:11 +0000 (22:36 +0000)] 
gh-115539: Allow enum.Flag to have None members (GH-115636)

20 months agogh-115543: Update py.exe to know about Python 3.13 and to install 3.12 by default...
Steve Dower [Mon, 19 Feb 2024 20:36:20 +0000 (20:36 +0000)] 
gh-115543: Update py.exe to know about Python 3.13 and to install 3.12 by default (GH-115544)

20 months agoFix typo in multiprocessing docs (#115650)
Naglis Jonaitis [Mon, 19 Feb 2024 18:19:14 +0000 (20:19 +0200)] 
Fix typo in multiprocessing docs (#115650)

20 months agogh-115664: Fix versionadded and versionchanged directives in multiprocessing.rst...
Serhiy Storchaka [Mon, 19 Feb 2024 18:03:42 +0000 (20:03 +0200)] 
gh-115664: Fix versionadded and versionchanged directives in multiprocessing.rst (GH-115665)

20 months agogh-115664: Fix chronological ordering of versionadded and versionchanged directives...
Brian Schubert [Mon, 19 Feb 2024 17:54:54 +0000 (12:54 -0500)] 
gh-115664: Fix chronological ordering of versionadded and versionchanged directives (#115676)

20 months agogh-60346: Improve handling single-dash options in ArgumentParser.parse_known_args...
Serhiy Storchaka [Mon, 19 Feb 2024 17:20:00 +0000 (19:20 +0200)] 
gh-60346: Improve handling single-dash options in ArgumentParser.parse_known_args() (GH-114180)

20 months agogh-115341: Fix loading unit tests with doctests in -OO mode (GH-115342)
Serhiy Storchaka [Mon, 19 Feb 2024 17:03:21 +0000 (19:03 +0200)] 
gh-115341: Fix loading unit tests with doctests in -OO mode (GH-115342)

20 months agoFix test_py_compile with -O mode (GH-115345)
Serhiy Storchaka [Mon, 19 Feb 2024 17:02:51 +0000 (19:02 +0200)] 
Fix test_py_compile with -O mode (GH-115345)

20 months agoFix test_compile with -O mode (GH-115346)
Serhiy Storchaka [Mon, 19 Feb 2024 17:02:29 +0000 (19:02 +0200)] 
Fix test_compile with -O mode (GH-115346)

20 months agogh-115154: Fix untokenize handling of unicode named literals (#115171)
Pablo Galindo Salgado [Mon, 19 Feb 2024 14:54:10 +0000 (14:54 +0000)] 
gh-115154: Fix untokenize handling of unicode named literals (#115171)

20 months agogh-115652: Fix indentation in the documentation of multiprocessing.get_start_method...
Daniel Haag [Mon, 19 Feb 2024 14:26:23 +0000 (15:26 +0100)] 
gh-115652: Fix indentation in the documentation of multiprocessing.get_start_method (GH-115658)

20 months agogh-114626: Add again _PyCFunctionFastWithKeywords name (GH-115561)
Victor Stinner [Mon, 19 Feb 2024 12:20:46 +0000 (13:20 +0100)] 
gh-114626: Add again _PyCFunctionFastWithKeywords name (GH-115561)

Keep the old private _PyCFunctionFastWithKeywords name (Python 3.7)
as an alias to the new public name PyCFunctionFastWithKeywords
(Python 3.13a4).

_PyCFunctionWithKeywords doesn't exist in Python 3.13a3, whereas
_PyCFunctionFastWithKeywords was removed in Python 3.13a4.

20 months agogh-83648: Add missing `deprecated` arg in argparse.rst (GH-115640)
0xflotus [Mon, 19 Feb 2024 08:29:32 +0000 (09:29 +0100)] 
gh-83648: Add missing `deprecated` arg in argparse.rst (GH-115640)

20 months agogh-102388: Add windows_31j to aliases for cp932 codec (#102389)
Masayuki Moriyama [Mon, 19 Feb 2024 08:01:35 +0000 (17:01 +0900)] 
gh-102388: Add windows_31j to aliases for cp932 codec (#102389)

The charset name "Windows-31J" is registered in the IANA Charset Registry[1]
and is implemented in Python as the cp932 codec.

[1] https://www.iana.org/assignments/charset-reg/windows-31J

Signed-off-by: Masayuki Moriyama <masayuki.moriyama@miraclelinux.com>
20 months agoDocs: Add explanation about little/big endian (#109841)
Simon A. Eugster [Mon, 19 Feb 2024 07:50:09 +0000 (08:50 +0100)] 
Docs: Add explanation about little/big endian (#109841)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
20 months agogh-111358: Fix timeout behaviour in BaseEventLoop.shutdown_default_executor (#115622)
Jamie Phan [Mon, 19 Feb 2024 00:01:00 +0000 (11:01 +1100)] 
gh-111358: Fix timeout behaviour in BaseEventLoop.shutdown_default_executor (#115622)

20 months agogh-114709: Mark commonpath behaviour as changed in 3.13 (#115639)
Shantanu [Sun, 18 Feb 2024 22:08:50 +0000 (14:08 -0800)] 
gh-114709: Mark commonpath behaviour as changed in 3.13 (#115639)

20 months agogh-115122: Add --bisect option to regrtest (#115123)
Victor Stinner [Sun, 18 Feb 2024 20:06:39 +0000 (21:06 +0100)] 
gh-115122: Add --bisect option to regrtest (#115123)

* test.bisect_cmd now exit with code 0 on success, and code 1 on
  failure. Before, it was the opposite.
* test.bisect_cmd now runs the test worker process with
  -X faulthandler.
* regrtest RunTests: Add create_python_cmd() and bisect_cmd()
  methods.

20 months agogh-115572: Move `codeobject.replace()` docs to the data model (#115631)
Daler [Sun, 18 Feb 2024 14:13:46 +0000 (19:13 +0500)] 
gh-115572: Move `codeobject.replace()` docs to the data model (#115631)

20 months agogh-114709: Fix exceptions raised by posixpath.commonpath (#114710)
Sebastian Rittau [Sun, 18 Feb 2024 08:24:58 +0000 (09:24 +0100)] 
gh-114709: Fix exceptions raised by posixpath.commonpath (#114710)

Fix the exceptions raised by posixpath.commonpath

Raise ValueError, not IndexError when passed an empty iterable. Raise
TypeError, not ValueError when passed None.

20 months agogh-108303: Move `Lib/test/sortperf.py` to `Tools/scripts` (#114687)
Nikita Sobolev [Sun, 18 Feb 2024 07:27:14 +0000 (10:27 +0300)] 
gh-108303: Move `Lib/test/sortperf.py` to `Tools/scripts` (#114687)

20 months agogh-115618: Remove improper Py_XDECREFs in property methods (GH-115619)
Serhiy Storchaka [Sat, 17 Feb 2024 21:18:30 +0000 (23:18 +0200)] 
gh-115618: Remove improper Py_XDECREFs in property methods (GH-115619)

20 months agogh-100176: Remove outdated Tools/{io,cc,string}bench (#101853)
Hugo van Kemenade [Sat, 17 Feb 2024 21:17:21 +0000 (23:17 +0200)] 
gh-100176: Remove outdated Tools/{io,cc,string}bench (#101853)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
20 months agogh-115596: Fix ProgramPriorityTests in test_os permanently changing the process prior...
Brian Schubert [Sat, 17 Feb 2024 16:42:57 +0000 (11:42 -0500)] 
gh-115596: Fix ProgramPriorityTests in test_os permanently changing the process priority (GH-115610)

20 months agoFix ProgramPriorityTests on FreeBSD with high nice value (GH-100145)
Dmitry Marakasov [Sat, 17 Feb 2024 14:54:47 +0000 (17:54 +0300)] 
Fix ProgramPriorityTests on FreeBSD with high nice value (GH-100145)

It expects priority to be capped with 19, which is the cap for Linux,
but for FreeBSD the cap is 20 and the test fails under the similar
conditions. Tweak the condition to cover FreeBSD as well.

20 months agogh-115567: Catch test_ctypes.test_callbacks.test_i38748_stackCorruption stdout output...
Kirill Podoprigora [Sat, 17 Feb 2024 13:17:55 +0000 (16:17 +0300)] 
gh-115567: Catch test_ctypes.test_callbacks.test_i38748_stackCorruption stdout output (GH-115568)

20 months agoDocument use of ANY in test assertions (GH-94060)
Thomas Grainger [Sat, 17 Feb 2024 13:13:34 +0000 (13:13 +0000)] 
Document use of ANY in test assertions (GH-94060)

20 months agogh-107155: Fix help() for lambda function with return annotation (GH-107401)
Kirill Podoprigora [Sat, 17 Feb 2024 12:47:51 +0000 (15:47 +0300)] 
gh-107155: Fix help() for lambda function with return annotation (GH-107401)

20 months agogh-96497: Mangle name before symtable lookup in 'symtable_extend_namedexpr_scope...
wookie184 [Sat, 17 Feb 2024 12:06:31 +0000 (12:06 +0000)] 
gh-96497: Mangle name before symtable lookup in 'symtable_extend_namedexpr_scope' (GH-96561)

20 months agogh-97590: Update docs and tests for ftplib.FTP.voidcmd() (GH-96825)
Matthew Hughes [Sat, 17 Feb 2024 11:57:51 +0000 (11:57 +0000)] 
gh-97590: Update docs and tests for ftplib.FTP.voidcmd() (GH-96825)

Since 2f3941d743481ac48628b8b2c075f2b82762050b this function returns the
response string, rather than nothing.

20 months agogh-95782: Fix io.BufferedReader.tell() etc. being able to return offsets < 0 (GH...
6t8k [Sat, 17 Feb 2024 11:16:06 +0000 (11:16 +0000)] 
gh-95782: Fix io.BufferedReader.tell() etc. being able to return offsets < 0 (GH-99709)

lseek() always returns 0 for character pseudo-devices like
`/dev/urandom` (for other non-regular files, e.g. `/dev/stdin`, it
always returns -1, to which CPython reacts by raising appropriate
exceptions). They are thus technically seekable despite not having seek
semantics.

When calling read() on e.g. an instance of `io.BufferedReader` that
wraps such a file, `BufferedReader` reads ahead, filling its buffer,
creating a discrepancy between the number of bytes read and the internal
`tell()` always returning 0, which previously resulted in e.g.
`BufferedReader.tell()` or `BufferedReader.seek()` being able to return
positions < 0 even though these are supposed to be always >= 0.

Invariably keep the return value non-negative by returning
max(former_return_value, 0) instead, and add some corresponding tests.

20 months agogh-56499: Update the pickle library's note section for the __setstate__ function...
Furkan Onder [Sat, 17 Feb 2024 10:51:43 +0000 (13:51 +0300)] 
gh-56499: Update the pickle library's note section for the __setstate__ function (GH-101062)

20 months agogh-87688: Amend SSLContext.hostname_checks_common_name docs (GH-100517)
Rami [Sat, 17 Feb 2024 10:22:19 +0000 (12:22 +0200)] 
gh-87688: Amend SSLContext.hostname_checks_common_name docs (GH-100517)

20 months agogh-100884: email/_header_value_parser: don't encode list separators (GH-100885)
Thomas Weißschuh [Sat, 17 Feb 2024 10:13:46 +0000 (11:13 +0100)] 
gh-100884: email/_header_value_parser: don't encode list separators (GH-100885)

ListSeparator should not be encoded. This could happen when a long line
pushes its separator to the next line, which would have been encoded.

20 months agogh-100985: Consistently wrap IPv6 IP address during CONNECT (GH-100986)
Derek Higgins [Sat, 17 Feb 2024 10:10:12 +0000 (10:10 +0000)] 
gh-100985: Consistently wrap IPv6 IP address during CONNECT (GH-100986)

Update _get_hostport to always remove square brackets
from IPv6 addresses. Then add them if needed
in "CONNECT .." and "Host: ".

20 months agogh-101100: Fix Sphinx warnings in `whatsnew/3.2.rst` (#115580)
Hugo van Kemenade [Sat, 17 Feb 2024 10:03:20 +0000 (12:03 +0200)] 
gh-101100: Fix Sphinx warnings in `whatsnew/3.2.rst` (#115580)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
20 months agogh-101100: Fix Sphinx warnings in `whatsnew/3.1.rst` (#115575)
Hugo van Kemenade [Sat, 17 Feb 2024 09:39:07 +0000 (11:39 +0200)] 
gh-101100: Fix Sphinx warnings in `whatsnew/3.1.rst` (#115575)

20 months agogh-101384: Add socket timeout to ThreadedVSOCKSocketStreamTest and skip it on WSL...
Peter Jiping Xie [Sat, 17 Feb 2024 09:12:12 +0000 (20:12 +1100)] 
gh-101384: Add socket timeout to ThreadedVSOCKSocketStreamTest and skip it on WSL (GH-101419)

20 months agogh-101699: Explain using Match.expand with \g<0> (GH-101701)
Stevoisiak [Sat, 17 Feb 2024 08:33:28 +0000 (03:33 -0500)] 
gh-101699: Explain using Match.expand with \g<0> (GH-101701)

Update documentation for re library to explain that a backreference `\g<0>` is
expanded to the entire string when using Match.expand().
Note that numeric backreferences to group 0 (`\0`) are not supported.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
20 months agogh-113812: Allow DatagramTransport.sendto to send empty data (#115199)
Jamie Phan [Sat, 17 Feb 2024 02:38:07 +0000 (13:38 +1100)] 
gh-113812: Allow DatagramTransport.sendto to send empty data (#115199)

Also include the UDP packet header sizes (8 bytes per packet)
in the buffer size reported to the flow control subsystem.

20 months agogh-111968: Split _Py_async_gen_asend_freelist out of _Py_async_gen_fr… (gh-115546)
Donghee Na [Sat, 17 Feb 2024 01:03:10 +0000 (10:03 +0900)] 
gh-111968: Split _Py_async_gen_asend_freelist out of _Py_async_gen_fr… (gh-115546)

20 months agodocs: Add glossary term references to shutil docs (#115559)
Brian Schubert [Fri, 16 Feb 2024 22:04:17 +0000 (17:04 -0500)] 
docs: Add glossary term references to shutil docs (#115559)

Add glossary term references to shutil docs

20 months agogh-85294: Handle missing arguments to @singledispatchmethod gracefully (GH-21471)
Ammar Askar [Fri, 16 Feb 2024 21:17:30 +0000 (16:17 -0500)] 
gh-85294: Handle missing arguments to @singledispatchmethod gracefully (GH-21471)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
20 months agogh-115103: Implement delayed memory reclamation (QSBR) (#115180)
Sam Gross [Fri, 16 Feb 2024 20:25:19 +0000 (15:25 -0500)] 
gh-115103: Implement delayed memory reclamation (QSBR) (#115180)

This adds a safe memory reclamation scheme based on FreeBSD's "GUS" and
quiescent state based reclamation (QSBR). The API provides a mechanism
for callers to detect when it is safe to free memory that may be
concurrently accessed by readers.

20 months agogh-115556: Remove quotes from command-line arguments in test.bat and rt.bat (#115557)
Łukasz Langa [Fri, 16 Feb 2024 20:24:56 +0000 (21:24 +0100)] 
gh-115556: Remove quotes from command-line arguments in test.bat and rt.bat (#115557)

This change essentially replaces usage of `%1` with `%~1`, which removes
quotes, if any. Without this change, the if statements fail due to
the quotes mangling the syntax.

Additionally, this change works around comma being treated as a parameter
delimiter in test.bat by escaping commas at time of parsing. Tested
combinations of rt and regrtest arguments, all seems to work as before
but now you can specify commas in arguments like "-uall,extralargefile".

20 months agogh-112720: make it easier to subclass and modify dis.ArgResolver's jump arg resolutio...
Irit Katriel [Fri, 16 Feb 2024 19:25:19 +0000 (19:25 +0000)] 
gh-112720: make it easier to subclass and modify dis.ArgResolver's jump arg resolution (#115564)

20 months agogh-114271: Make `thread._rlock` thread-safe in free-threaded builds (#115102)
mpage [Fri, 16 Feb 2024 18:29:25 +0000 (10:29 -0800)] 
gh-114271: Make `thread._rlock` thread-safe in free-threaded builds (#115102)

The ID of the owning thread (`rlock_owner`) may be accessed by
multiple threads without holding the underlying lock; relaxed
atomics are used in place of the previous loads/stores.

The number of times that the lock has been acquired (`rlock_count`)
is only ever accessed by the thread that holds the lock; we do not
need to use atomics to access it.

20 months agogh-115480: Type / constant propagation for float binary uops (GH-115550)
Peter Lazorchak [Fri, 16 Feb 2024 18:02:48 +0000 (10:02 -0800)] 
gh-115480: Type / constant propagation for float binary uops (GH-115550)

Co-authored-by: Ken Jin <kenjin@python.org>
20 months agogh-115362: Add documentation to pystats output (#115365)
Michael Droettboom [Fri, 16 Feb 2024 17:06:07 +0000 (12:06 -0500)] 
gh-115362: Add documentation to pystats output (#115365)

20 months agogh-113743: Give _PyTypes_AfterFork a prototype. (gh-115563)
Benjamin Peterson [Fri, 16 Feb 2024 16:49:41 +0000 (08:49 -0800)] 
gh-113743: Give _PyTypes_AfterFork a prototype. (gh-115563)

Fixes a compiler warning.

20 months agogh-112529: Make the GC scheduling thread-safe (#114880)
Sam Gross [Fri, 16 Feb 2024 16:22:27 +0000 (11:22 -0500)] 
gh-112529: Make the GC scheduling thread-safe (#114880)

The GC keeps track of the number of allocations (less deallocations)
since the last GC. This buffers the count in thread-local state and uses
atomic operations to modify the per-interpreter count. The thread-local
buffering avoids contention on shared state.

A consequence is that the GC scheduling is not as precise, so
"test_sneaky_frame_object" is skipped because it requires that the GC be
run exactly after allocating a frame object.

20 months agogh-115480: Minor fixups in int constant propagation (GH-115507)
Ken Jin [Fri, 16 Feb 2024 14:59:43 +0000 (22:59 +0800)] 
gh-115480: Minor fixups in int constant propagation (GH-115507)

20 months agogh-102013: Move PyUnstable_GC_VisitObjects() to Include/cpython/objimpl.h (#115560)
Victor Stinner [Fri, 16 Feb 2024 14:49:13 +0000 (15:49 +0100)] 
gh-102013: Move PyUnstable_GC_VisitObjects() to Include/cpython/objimpl.h (#115560)

Include/objimpl.h must only contain the limited C API, whereas
PyUnstable_GC_VisitObjects() is excluded from the limited C API.

20 months agoAdd `Python/tier2_redundancy_eliminator_cases.c.h` to `.gitattributes` as generated...
Nikita Sobolev [Fri, 16 Feb 2024 13:10:21 +0000 (16:10 +0300)] 
Add `Python/tier2_redundancy_eliminator_cases.c.h` to `.gitattributes` as generated (#115551)

20 months agogh-69990: Make Profile.print_stats support sorting by multiple values (GH-104590)
Furkan Onder [Fri, 16 Feb 2024 12:03:46 +0000 (15:03 +0300)] 
gh-69990: Make Profile.print_stats support sorting by multiple values (GH-104590)

Co-authored-by: Chiu-Hsiang Hsu
20 months agogh-113317: Argument Clinic: move C/Py identifier helpers into libclinic (#115520)
Erlend E. Aasland [Fri, 16 Feb 2024 06:42:15 +0000 (07:42 +0100)] 
gh-113317: Argument Clinic: move C/Py identifier helpers into libclinic (#115520)

20 months agogh-115503: Fix `run_presite` error handling (#115504)
Nikita Sobolev [Fri, 16 Feb 2024 05:33:17 +0000 (08:33 +0300)] 
gh-115503: Fix `run_presite` error handling (#115504)

20 months agogh-111968: Split _Py_dictkeys_freelist out of _Py_dict_freelist (gh-115505)
Donghee Na [Fri, 16 Feb 2024 01:01:36 +0000 (10:01 +0900)] 
gh-111968: Split _Py_dictkeys_freelist out of _Py_dict_freelist (gh-115505)

20 months agogh-113743: Use per-interpreter locks for types (#115541)
Dino Viehland [Fri, 16 Feb 2024 00:28:31 +0000 (16:28 -0800)] 
gh-113743: Use per-interpreter locks for types (#115541)

Move type-lock to per-interpreter lock to avoid heavy contention in interpreters test

20 months agogh-114572: Fix locking in cert_store_stats and get_ca_certs (#114573)
David Benjamin [Fri, 16 Feb 2024 00:24:51 +0000 (19:24 -0500)] 
gh-114572: Fix locking in cert_store_stats and get_ca_certs (#114573)

* gh-114572: Fix locking in cert_store_stats and get_ca_certs

cert_store_stats and get_ca_certs query the SSLContext's X509_STORE with
X509_STORE_get0_objects, but reading the result requires a lock. See
https://github.com/openssl/openssl/pull/23224 for details.

Instead, use X509_STORE_get1_objects, newly added in that PR.
X509_STORE_get1_objects does not exist in current OpenSSLs, but we can
polyfill it with X509_STORE_lock and X509_STORE_unlock.

* Work around const-correctness problem

* Add missing X509_STORE_get1_objects failure check

* Add blurb

20 months agogh-113317: Argument Clinic: move linear_format into libclinic (#115518)
Erlend E. Aasland [Thu, 15 Feb 2024 22:52:20 +0000 (23:52 +0100)] 
gh-113317: Argument Clinic: move linear_format into libclinic (#115518)

20 months agogh-115498: Fix `SET_COUNT` error handling in `_xxinterpchannelsmodule` (#115499)
Nikita Sobolev [Thu, 15 Feb 2024 21:31:23 +0000 (00:31 +0300)] 
gh-115498: Fix `SET_COUNT` error handling in `_xxinterpchannelsmodule` (#115499)

20 months agoMerge branch 'main' of https://github.com/python/cpython
Thomas Wouters [Thu, 15 Feb 2024 20:53:06 +0000 (21:53 +0100)] 
Merge branch 'main' of https://github.com/python/cpython

20 months agoPost 3.13.0a4
Thomas Wouters [Thu, 15 Feb 2024 20:52:49 +0000 (21:52 +0100)] 
Post 3.13.0a4

20 months agogh-113743: Make the MRO cache thread-safe in free-threaded builds (#113930)
Dino Viehland [Thu, 15 Feb 2024 18:54:57 +0000 (10:54 -0800)] 
gh-113743: Make the MRO cache thread-safe in free-threaded builds (#113930)

Makes _PyType_Lookup thread safe, including:
    Thread safety of the underlying cache.
    Make mutation of mro and type members thread safe
    Also _PyType_GetMRO and _PyType_GetBases are currently returning borrowed references which aren't safe.

20 months agogh-113317: Argument Clinic: inline required_type_for_self_for_parser() in self conver...
Erlend E. Aasland [Thu, 15 Feb 2024 16:03:58 +0000 (17:03 +0100)] 
gh-113317: Argument Clinic: inline required_type_for_self_for_parser() in self converter (#115522)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
20 months agogh-100734: What's New in 3.x: Add missing detail from 3.x branch (#114689)
Hugo van Kemenade [Thu, 15 Feb 2024 15:32:33 +0000 (17:32 +0200)] 
gh-100734: What's New in 3.x: Add missing detail from 3.x branch (#114689)

20 months agogh-112433: Add optional _align_ attribute to ctypes.Structure (GH-113790)
monkeyman192 [Thu, 15 Feb 2024 14:40:20 +0000 (01:40 +1100)] 
gh-112433: Add optional _align_ attribute to ctypes.Structure (GH-113790)

20 months agogh-115420: Fix translation of exception hander targets by _testinternalcapi.optimize_...
Irit Katriel [Thu, 15 Feb 2024 14:32:52 +0000 (14:32 +0000)] 
gh-115420: Fix translation of exception hander targets by _testinternalcapi.optimize_cfg. (#115425)

20 months agogh-115376: fix segfault in _testinternalcapi.compiler_codegen on bad input (#115379)
Irit Katriel [Thu, 15 Feb 2024 14:32:21 +0000 (14:32 +0000)] 
gh-115376: fix segfault in _testinternalcapi.compiler_codegen on bad input (#115379)

20 months agogh-115124: Use _PyObject_ASSERT() in gc.c (#115125)
Victor Stinner [Thu, 15 Feb 2024 14:29:42 +0000 (15:29 +0100)] 
gh-115124: Use _PyObject_ASSERT() in gc.c (#115125)

Replace assert() with _PyObject_ASSERT() in gc.c to dump the object
when an assertion fails.

20 months agogh-115347: avoid emitting redundant NOP for the docstring with -OO (#115494)
Irit Katriel [Thu, 15 Feb 2024 14:20:19 +0000 (14:20 +0000)] 
gh-115347: avoid emitting redundant NOP for the docstring with -OO (#115494)

20 months agoPython 3.13.0a4 v3.13.0a4
Thomas Wouters [Thu, 15 Feb 2024 13:30:16 +0000 (14:30 +0100)] 
Python 3.13.0a4

20 months agogh-115432: Add critical section variant that handles a NULL object (#115433)
Sam Gross [Thu, 15 Feb 2024 13:37:54 +0000 (08:37 -0500)] 
gh-115432: Add critical section variant that handles a NULL object (#115433)

This adds `Py_XBEGIN_CRITICAL_SECTION` and
`Py_XEND_CRITICAL_SECTION`, which accept a possibly NULL object as an
argument. If the argument is NULL, then nothing is locked or unlocked.
Otherwise, they behave like `Py_BEGIN/END_CRITICAL_SECTION`.

20 months agogh-115490: Work around test.support.interpreters.channels not handling unloading...
T. Wouters [Thu, 15 Feb 2024 13:24:13 +0000 (14:24 +0100)] 
gh-115490: Work around test.support.interpreters.channels not handling unloading (#115515)

Work around test.support.interpreters.channels not handling unloading, which
regrtest does when running tests sequentially, by explicitly skipping the
unloading of test.support.interpreters and its submodules.

This can be rolled back once test.support.interpreters.channels supports
unloading, if we are keeping sequential runs in the same process around.