]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
10 months agoAdd `extern "C"` around `PyTraceMalloc_` functions. (#127772)
Peter Hawkins [Wed, 11 Dec 2024 09:27:07 +0000 (04:27 -0500)] 
Add `extern "C"` around `PyTraceMalloc_` functions. (#127772)

Pretty much everything else exported by Python.h has an extern "C"
annotation, yet this header appears to be missing one.

10 months agogh-127740: For odd-length input to bytes.fromhex(...) change the error message to...
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) [Wed, 11 Dec 2024 07:35:17 +0000 (13:05 +0530)] 
gh-127740: For odd-length input to bytes.fromhex(...) change the error message to  ValueError: fromhex() arg must be of even length (#127756)

10 months agoGH-127381: pathlib ABCs: remove `PathBase.samefile()` and rarer `is_*()` (#127709)
Barney Gale [Wed, 11 Dec 2024 00:09:55 +0000 (00:09 +0000)] 
GH-127381: pathlib ABCs: remove `PathBase.samefile()` and rarer `is_*()` (#127709)

Remove `PathBase.samefile()`, which is fairly specific to the local FS, and
relies on `stat()`, which we're aiming to remove from `PathBase`.

Also remove `PathBase.is_mount()`, `is_junction()`, `is_block_device()`,
`is_char_device()`, `is_fifo()` and `is_socket()`. These rely on POSIX
file type numbers that we're aiming to remove from the `PathBase` API.

10 months agogh-126821: Add versionadded annotation to use_system_logger feature. (#127755)
Russell Keith-Magee [Tue, 10 Dec 2024 21:32:04 +0000 (05:32 +0800)] 
gh-126821: Add versionadded annotation to use_system_logger feature. (#127755)

Add versionadded annotation to use_system_logger feature.

10 months agoDocs: Fix indents in `xmlrpc.client.rst` (#127782)
Yuki Kobayashi [Tue, 10 Dec 2024 17:35:00 +0000 (02:35 +0900)] 
Docs: Fix indents in `xmlrpc.client.rst` (#127782)

10 months agogh-59705: Set OS thread name when Thread.name is changed (#127702)
Victor Stinner [Tue, 10 Dec 2024 16:33:11 +0000 (17:33 +0100)] 
gh-59705: Set OS thread name when Thread.name is changed (#127702)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
10 months agogh-127563: use `dk_log2_index_bytes=3` in empty dicts (GH-127568)
Bénédikt Tran [Tue, 10 Dec 2024 15:58:17 +0000 (16:58 +0100)] 
gh-127563: use `dk_log2_index_bytes=3` in empty dicts (GH-127568)

This fixes a UBSan failure (unaligned zero-size memcpy) in `dictobject.c`.

10 months agogh-126937: ctypes: fix TypeError when a field's size is >65535 bytes (GH-126938)
Melissa0x1f992 [Tue, 10 Dec 2024 12:13:11 +0000 (06:13 -0600)] 
gh-126937: ctypes: fix TypeError when a field's size is >65535 bytes (GH-126938)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
10 months agogh-127257: ssl: Raise OSError for ERR_LIB_SYS (GH-127361)
Petr Viktorin [Tue, 10 Dec 2024 10:56:24 +0000 (11:56 +0100)] 
gh-127257: ssl: Raise OSError for ERR_LIB_SYS (GH-127361)

From the ERR_raise manpage:

    ERR_LIB_SYS

        This "library code" indicates that a system error is
        being reported.  In this case, the reason code given
        to `ERR_raise()` and `ERR_raise_data()` *must* be
        `errno(3)`.

This PR only handles ERR_LIB_SYS for the high-lever error types
SSL_ERROR_SYSCALL and SSL_ERROR_SSL, i.e., not the ones where
OpenSSL indicates it has some more information about the issue.

10 months agogh-126491: Revert "GH-126491: Lower heap size limit with faster marking (GH-127519...
Petr Viktorin [Tue, 10 Dec 2024 10:53:56 +0000 (11:53 +0100)] 
gh-126491: Revert "GH-126491: Lower heap size limit with faster marking (GH-127519)" (GH-127770)

Revert "GH-126491: Lower heap size limit with faster marking (GH-127519)"

This reverts commit 023b7d2141467017abc27de864f3f44677768cb3, which introduced
a refleak.

10 months agoAdd zizmor to pre-commit and fix most findings (#127749)
Hugo van Kemenade [Tue, 10 Dec 2024 10:51:12 +0000 (12:51 +0200)] 
Add zizmor to pre-commit and fix most findings (#127749)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
10 months agogh-101100: Fix sphinx warnings in `whatsnew/3.0.rst` (#127662)
Yuki Kobayashi [Tue, 10 Dec 2024 10:22:37 +0000 (19:22 +0900)] 
gh-101100: Fix sphinx warnings in `whatsnew/3.0.rst` (#127662)

10 months agogh-125420: implement `Sequence.count` API on `memoryview` objects (#125443)
Bénédikt Tran [Tue, 10 Dec 2024 10:12:33 +0000 (11:12 +0100)] 
gh-125420: implement `Sequence.count` API on `memoryview` objects (#125443)

10 months agoadd help blurb for "extralargefile" (#127710)
Skip Montanaro [Tue, 10 Dec 2024 08:17:25 +0000 (02:17 -0600)] 
add help blurb for "extralargefile" (#127710)

10 months agogh-127718: Add colour to `test.regrtest` output (#127719)
Hugo van Kemenade [Tue, 10 Dec 2024 07:44:15 +0000 (09:44 +0200)] 
gh-127718: Add colour to `test.regrtest` output (#127719)

10 months agogh-126775: make linecache.checkcache threadsafe and GC re-entrency safe (#126776)
Thomas Grainger [Tue, 10 Dec 2024 07:40:54 +0000 (07:40 +0000)] 
gh-126775: make linecache.checkcache threadsafe and GC re-entrency safe (#126776)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com>
10 months agogh-127651: Use __file__ in diagnostics if origin is missing (#127660)
Shantanu [Tue, 10 Dec 2024 04:55:20 +0000 (20:55 -0800)] 
gh-127651: Use __file__ in diagnostics if origin is missing (#127660)

See the left hand side in https://github.com/python/cpython/pull/123929/files#diff-c22186367cbe20233e843261998dc027ae5f1f8c0d2e778abfa454ae74cc59deL2840-L2849

---------

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
11 months agogh-125420: implement `Sequence.index` API on `memoryview` objects (#125446)
Bénédikt Tran [Tue, 10 Dec 2024 02:48:38 +0000 (03:48 +0100)] 
gh-125420: implement `Sequence.index` API on `memoryview` objects (#125446)

11 months agogh-127629: Add ctypes to the Emscripten build (#127683)
Hood Chatham [Tue, 10 Dec 2024 02:32:58 +0000 (03:32 +0100)] 
gh-127629: Add ctypes to the Emscripten build (#127683)

Adds tooling to build libffi and add ctypes to the stdlib for Emscripten.

11 months agoGH-127456: pathlib ABCs: add protocol for path parser (#127494)
Barney Gale [Mon, 9 Dec 2024 18:31:22 +0000 (18:31 +0000)] 
GH-127456: pathlib ABCs: add protocol for path parser (#127494)

Change the default value of `PurePathBase.parser` from `ParserBase()` to
`posixpath`. As a result, user subclasses of `PurePathBase` and `PathBase`
use POSIX path syntax by default, which is very often desirable.

Move `pathlib._abc.ParserBase` to `pathlib._types.Parser`, and convert it
to a runtime-checkable protocol.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 months agogh-127637: add tests for `dis` command-line interface (#127759)
Bénédikt Tran [Mon, 9 Dec 2024 18:02:22 +0000 (19:02 +0100)] 
gh-127637: add tests for `dis` command-line interface (#127759)

11 months agogh-127732: Add Windows Server 2025 detection to platform module (GH-127733)
Wulian [Mon, 9 Dec 2024 12:24:26 +0000 (20:24 +0800)] 
gh-127732: Add Windows Server 2025 detection to platform module (GH-127733)

11 months agogh-126925: Modify how iOS test results are gathered (#127592)
Russell Keith-Magee [Mon, 9 Dec 2024 05:28:57 +0000 (13:28 +0800)] 
gh-126925: Modify how iOS test results are gathered (#127592)

Adds a `use_system_log` config item to enable stdout/stderr redirection for
Apple platforms. This log streaming is then used by a new iOS test runner
script, allowing the display of test suite output at runtime. The iOS test
runner script can be used by any Python project, not just the CPython test
suite.

11 months agogh-127503: Fix realpath handling in emscripten cli (#127632)
Hood Chatham [Mon, 9 Dec 2024 02:03:11 +0000 (03:03 +0100)] 
gh-127503: Fix realpath handling in emscripten cli (#127632)

Corrects the handling of realpath on Linux.

11 months agogh-127503 Don't propagate native PATH to Emscripten Python (#127633)
Hood Chatham [Mon, 9 Dec 2024 02:01:37 +0000 (03:01 +0100)] 
gh-127503 Don't propagate native PATH to Emscripten Python (#127633)

Modifies the handling of PATH to ensure that native executables aren't picked
up when running under node.

11 months agogh-127111: Emscripten Move link flags from `LDFLAGS_NODIST` to `LINKFORSHARED` (...
Hood Chatham [Mon, 9 Dec 2024 01:34:28 +0000 (02:34 +0100)] 
gh-127111: Emscripten Move link flags from `LDFLAGS_NODIST` to `LINKFORSHARED` (#127666)

Corrects the usage of linking flags to avoid compilation errors related to the
use of `-sEXPORTED_FUNCTIONS` when linking shared libraries.

11 months agogh-127734: improve signature of `urllib.request.HTTPPasswordMgrWithPriorAuth.__init__...
Stephen Morton [Sun, 8 Dec 2024 18:46:34 +0000 (10:46 -0800)] 
gh-127734: improve signature of `urllib.request.HTTPPasswordMgrWithPriorAuth.__init__` (#127735)

improve signature of urllib.request.HTTPPasswordMgrWithPriorAuth.__init__

11 months agoGH-127381: pathlib ABCs: remove `PathBase.unlink()` and `rmdir()` (#127736)
Barney Gale [Sun, 8 Dec 2024 18:45:09 +0000 (18:45 +0000)] 
GH-127381: pathlib ABCs: remove `PathBase.unlink()` and `rmdir()` (#127736)

Virtual filesystems don't always make a distinction between deleting files
and empty directories, and sometimes support deleting non-empty directories
in a single operation. Here we remove `PathBase.unlink()` and `rmdir()`,
leaving `_delete()` as the sole deletion method, now made abstract. I hope
to drop the underscore prefix later on.

11 months ago[doc] Fix typos in `interpreter_definition.md` (#127742)
Stan Ulbrych [Sun, 8 Dec 2024 18:01:55 +0000 (18:01 +0000)] 
[doc] Fix typos in `interpreter_definition.md` (#127742)

11 months agogh-87138: convert SHA-3 object type to heap type (GH-127670)
Bénédikt Tran [Sun, 8 Dec 2024 17:31:10 +0000 (18:31 +0100)] 
gh-87138: convert SHA-3 object type to heap type (GH-127670)

11 months agogh-123378: fix post-merge typos in comments and NEWS (#127739)
Bénédikt Tran [Sun, 8 Dec 2024 13:47:22 +0000 (14:47 +0100)] 
gh-123378: fix post-merge typos in comments and NEWS (#127739)

11 months agogh-127610: Added validation for more than one var-positional and var-keyword paramete...
Apostol Fet [Sun, 8 Dec 2024 10:05:15 +0000 (13:05 +0300)] 
gh-127610: Added validation for more than one var-positional and var-keyword parameters in inspect.Signature (GH-127657)

11 months agoGH-126789: fix some sysconfig data on late site initializations (#127729)
Filipe Laíns 🇵🇸 [Sun, 8 Dec 2024 05:57:22 +0000 (05:57 +0000)] 
GH-126789: fix some sysconfig data on late site initializations (#127729)

11 months agoGH-127090: Fix `urllib.response.addinfourl.url` value for opened `file:` URIs (#127091)
Barney Gale [Sat, 7 Dec 2024 17:58:42 +0000 (17:58 +0000)] 
GH-127090: Fix `urllib.response.addinfourl.url` value for opened `file:` URIs (#127091)

The canonical `file:` URL (as generated by `pathname2url()`) is now used as the `url` attribute of the returned `addinfourl` object. The `addinfourl.url` attribute reflects the resolved URL for both `file:` or `http[s]:` URLs now.

11 months agoGive `poplib.POP3.rpop` a proper docstring (#127370)
Stan Ulbrych [Sat, 7 Dec 2024 16:13:49 +0000 (16:13 +0000)] 
Give `poplib.POP3.rpop` a proper docstring (#127370)

Previously `poplib.POP3.rpop` had a "Not sure what this does" docstring, now it has been fixed.

11 months agogh-119786: fix typo in `InternalDocs/garbage_collector.md` (#127687)
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) [Sat, 7 Dec 2024 10:12:45 +0000 (15:42 +0530)] 
gh-119786: fix typo in `InternalDocs/garbage_collector.md` (#127687)

11 months agoGH-127381: pathlib ABCs: remove `PathBase.resolve()` and `absolute()` (#127707)
Barney Gale [Fri, 6 Dec 2024 21:39:45 +0000 (21:39 +0000)] 
GH-127381: pathlib ABCs: remove `PathBase.resolve()` and `absolute()` (#127707)

Remove our implementation of POSIX path resolution in `PathBase.resolve()`.
This functionality is rather fragile and isn't necessary in most cases. It
depends on `PathBase.stat()`, which we're looking to remove.

Also remove `PathBase.absolute()`. Many legitimate virtual filesystems lack
the notion of a 'current directory', so it's wrong to include in the basic
interface.

11 months agoGH-127652: stop using `--wasi preview2` in `wasi.py` (GH-127704)
Brett Cannon [Fri, 6 Dec 2024 18:42:05 +0000 (10:42 -0800)] 
GH-127652: stop using `--wasi preview2` in `wasi.py` (GH-127704)

It's only to use WASI 0.2 code to back preview1 APIs and is considered experimental anyway.

11 months agoGH-127381: pathlib ABCs: remove `PathBase.rename()` and `replace()` (#127658)
Barney Gale [Fri, 6 Dec 2024 18:10:00 +0000 (18:10 +0000)] 
GH-127381: pathlib ABCs: remove `PathBase.rename()` and `replace()` (#127658)

These methods are obviated by `PathBase.move()`, which can move directories
and supports any `PathBase` object as a target.

11 months agoFix typo in `Lib/_android_support.py` (#127699)
Stan Ulbrych [Fri, 6 Dec 2024 17:50:58 +0000 (17:50 +0000)] 
Fix typo in `Lib/_android_support.py` (#127699)

11 months agogh-119786: Add jit.md. Move adaptive.md to a section of interpreter.md. (#127175)
Irit Katriel [Fri, 6 Dec 2024 16:36:06 +0000 (16:36 +0000)] 
gh-119786: Add jit.md. Move adaptive.md to a section of interpreter.md. (#127175)

11 months agogh-59705: Add _thread.set_name() function (#127338)
Victor Stinner [Fri, 6 Dec 2024 16:27:12 +0000 (17:27 +0100)] 
gh-59705: Add _thread.set_name() function (#127338)

On Linux, threading.Thread now sets the thread name to the operating
system.

* configure now checks if pthread_getname_np()
  and pthread_setname_np() functions are available.
* Add PYTHREAD_NAME_MAXLEN macro.
* Add _thread._NAME_MAXLEN constant for test_threading.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
11 months agogh-127314: Don't mention the GIL when calling without a thread state on the free...
Peter Bierma [Fri, 6 Dec 2024 15:58:19 +0000 (10:58 -0500)] 
gh-127314: Don't mention the GIL when calling without a thread state on the free-threaded build (#127315)

Co-authored-by: Victor Stinner <vstinner@python.org>
11 months agogh-125610: Fix `STORE_ATTR_INSTANCE_VALUE` specialization check (GH-125612)
Sam Gross [Fri, 6 Dec 2024 15:48:24 +0000 (15:48 +0000)] 
gh-125610: Fix `STORE_ATTR_INSTANCE_VALUE` specialization check (GH-125612)

The `STORE_ATTR_INSTANCE_VALUE` opcode doesn't support objects with
non-NULL managed dictionaries, so don't specialize to that op in that case.

11 months agogh-126024: fix UBSan failure in `unicodeobject.c:find_first_nonascii` (GH-127566)
Bénédikt Tran [Fri, 6 Dec 2024 14:31:30 +0000 (15:31 +0100)] 
gh-126024: fix UBSan failure in `unicodeobject.c:find_first_nonascii` (GH-127566)

11 months agogh-101100: amend references starting with `!~` in gh-127054 (#127684)
Yuki Kobayashi [Fri, 6 Dec 2024 14:09:20 +0000 (23:09 +0900)] 
gh-101100: amend references starting with `!~` in gh-127054 (#127684)

11 months agoGH-126491: Lower heap size limit with faster marking (GH-127519)
Mark Shannon [Fri, 6 Dec 2024 10:46:59 +0000 (10:46 +0000)] 
GH-126491: Lower heap size limit with faster marking (GH-127519)

* Faster marking of reachable objects

* Changes calculation of work to do and work done.

* Merges transitive closure calculations

11 months agogh-120010: Fix invalid (nan+nanj) results in _Py_c_prod() (GH-120287)
Sergey B Kirpichev [Fri, 6 Dec 2024 10:28:32 +0000 (13:28 +0300)] 
gh-120010: Fix invalid (nan+nanj) results in _Py_c_prod() (GH-120287)

In some cases, previously computed as (nan+nanj), we could recover
meaningful component values in the result, see e.g. the C11, Annex
G.5.1, routine _Cmultd():

>>> z = 1e300+1j
>>> z*(nan+infj)  # was (nan+nanj)
(-inf+infj)

That also fix some complex powers for small integer exponents, computed
with optimized algorithm (by squaring):

>>> z**5  # was (nan+nanj)
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    z**5
    ~^^~
OverflowError: complex exponentiation

11 months agogh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the protocol if needed...
J. Nick Koston [Fri, 6 Dec 2024 04:33:03 +0000 (22:33 -0600)] 
gh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the protocol if needed (#127656)

Ensure `_SelectorSocketTransport.writelines` pauses the protocol if it reaches the high water mark as needed.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
11 months agogh-127627: Add `posix._emscripten_debugger` function (#127628)
Hood Chatham [Fri, 6 Dec 2024 02:47:51 +0000 (03:47 +0100)] 
gh-127627: Add `posix._emscripten_debugger` function (#127628)

Add a posix._emscripten_debugger function to add an emscripten breakpoint.

11 months agoGH-125413: Revert addition of `pathlib.Path.scandir()` method (#127377)
Barney Gale [Thu, 5 Dec 2024 21:39:43 +0000 (21:39 +0000)] 
GH-125413: Revert addition of `pathlib.Path.scandir()` method (#127377)

Remove documentation for `pathlib.Path.scandir()`, and rename the method to
`_scandir()`. In the private pathlib ABCs, make `iterdir()` abstract and
call it from `_scandir()`.

It's not worthwhile to add this method at the moment - see discussion:
https://discuss.python.org/t/ergonomics-of-new-pathlib-path-scandir/71721

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
11 months agogh-127582: Make object resurrection thread-safe for free threading. (GH-127612)
Sam Gross [Thu, 5 Dec 2024 21:07:31 +0000 (21:07 +0000)] 
gh-127582: Make object resurrection thread-safe for free threading. (GH-127612)

Objects may be temporarily "resurrected" in destructors when calling
finalizers or watcher callbacks. We previously undid the resurrection
by decrementing the reference count using `Py_SET_REFCNT`. This was not
thread-safe because other threads might be accessing the object
(modifying its reference count) if it was exposed by the finalizer,
watcher callback, or temporarily accessed by a racy dictionary or list
access.

This adds internal-only thread-safe functions for temporary object
resurrection during destructors.

11 months ago[Docs] GDB howto: Fix block type of a cast example (#127621)
Maciej Olko [Thu, 5 Dec 2024 20:52:58 +0000 (21:52 +0100)] 
[Docs] GDB howto: Fix block type of a cast example (#127621)

11 months agogh-127221: Add colour to unittest output (#127223)
Hugo van Kemenade [Thu, 5 Dec 2024 19:10:46 +0000 (21:10 +0200)] 
gh-127221: Add colour to unittest output (#127223)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
11 months agoGH-126727: Fix test_era_nl_langinfo with Japanese ERAs on Solaris (GH-127327)
Jakub Kulík [Thu, 5 Dec 2024 18:43:19 +0000 (19:43 +0100)] 
GH-126727: Fix test_era_nl_langinfo with Japanese ERAs on Solaris (GH-127327)

Fix test_era_nl_langinfo with Japanese ERAs on Solaris

11 months agogh-122431: Disallow negative values in `readline.append_history_file` (#122469)
Peter Bierma [Thu, 5 Dec 2024 16:07:38 +0000 (11:07 -0500)] 
gh-122431: Disallow negative values in `readline.append_history_file` (#122469)

Co-authored-by: Victor Stinner <vstinner@python.org>
11 months agogh-127413: allow to show specialized bytecode via `dis` CLI (#127414)
Bénédikt Tran [Thu, 5 Dec 2024 15:01:59 +0000 (16:01 +0100)] 
gh-127413: allow to show specialized bytecode via `dis` CLI (#127414)

11 months agogh-93312: Include <sys/pidfd.h> to get PIDFD_NONBLOCK (#127593)
Victor Stinner [Thu, 5 Dec 2024 09:39:44 +0000 (10:39 +0100)] 
gh-93312: Include <sys/pidfd.h> to get PIDFD_NONBLOCK (#127593)

11 months agogh-119182: Complete PyUnicodeWriter documentation (#127607)
Victor Stinner [Thu, 5 Dec 2024 09:37:14 +0000 (10:37 +0100)] 
gh-119182: Complete PyUnicodeWriter documentation (#127607)

11 months agogh-127434: Fix iOS `xcrun --sdk` clang/ar scripts to allow arguments with spaces...
Feodor Fitsner [Thu, 5 Dec 2024 03:00:20 +0000 (19:00 -0800)] 
gh-127434: Fix iOS `xcrun --sdk` clang/ar scripts to allow arguments with spaces (#127575)

Added shell escaping to ensure iOS compiler shims can accept arguments with spaces.

11 months agogh-127503: Emscripten make Python.sh function as proper Python CLI (#127506)
Hood Chatham [Thu, 5 Dec 2024 00:44:50 +0000 (01:44 +0100)] 
gh-127503: Emscripten make Python.sh function as proper Python CLI (#127506)

Modifies the python.sh script to work on macOS, and adapt to recent emscripten changes.

11 months agogh-127146: Emscripten: Skip segfaults in test suite (#127151)
Hood Chatham [Thu, 5 Dec 2024 00:26:25 +0000 (01:26 +0100)] 
gh-127146: Emscripten: Skip segfaults in test suite (#127151)

Added skips for tests known to cause problems when running on Emscripten.
These mostly relate to the limited stack depth on Emscripten.

11 months agogh-127111: Apply prettier formatter to Emscripten web example (#127551)
Hood Chatham [Thu, 5 Dec 2024 00:25:06 +0000 (01:25 +0100)] 
gh-127111: Apply prettier formatter to Emscripten web example (#127551)

Cleaned up formatting (and a stray closing tag) of the web example HTML and JS.

11 months agoGH-126795: Increase the JIT side-exit threshold from 64 to 4096 (GH-127155)
Brandt Bucher [Wed, 4 Dec 2024 23:01:28 +0000 (15:01 -0800)] 
GH-126795: Increase the JIT side-exit threshold from 64 to 4096 (GH-127155)

11 months agoEnable native AArch64 Ubuntu CI jobs (#127584)
Diego Russo [Wed, 4 Dec 2024 22:12:06 +0000 (22:12 +0000)] 
Enable native AArch64 Ubuntu CI jobs (#127584)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
11 months agogh-127536: Add missing locks in listobject.c (GH-127580)
Sam Gross [Wed, 4 Dec 2024 19:12:15 +0000 (19:12 +0000)] 
gh-127536: Add missing locks in listobject.c (GH-127580)

We were missing locks around some list operations in the free threading
build.

11 months agogh-127552: Remove comment questioning 4-digit restriction for ‘Y’ in datetime.strptim...
Beomsoo Kim [Wed, 4 Dec 2024 18:30:51 +0000 (03:30 +0900)] 
gh-127552: Remove comment questioning 4-digit restriction for ‘Y’ in datetime.strptime patterns (#127590)

The code has required 4 digits for the year since its inclusion in the stdlib in 2002 (over 22 years ago as of this commit).

11 months agogh-127481: Add `EPOLLWAKEUP` to the `select` module (GH-127482)
RUANG (James Roy) [Wed, 4 Dec 2024 13:30:38 +0000 (21:30 +0800)] 
gh-127481: Add `EPOLLWAKEUP` to the `select` module (GH-127482)

11 months agogh-123378: Ensure results of `PyUnicode*Error_Get{Start,End}` are clamped (GH-123380)
Bénédikt Tran [Wed, 4 Dec 2024 13:13:52 +0000 (14:13 +0100)] 
gh-123378: Ensure results of `PyUnicode*Error_Get{Start,End}` are clamped (GH-123380)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
11 months agogh-126524: Run `regen-unicodedata` as a part of our CI (#126682)
sobolevn [Wed, 4 Dec 2024 10:01:46 +0000 (13:01 +0300)] 
gh-126524: Run `regen-unicodedata` as a part of our CI (#126682)

11 months agogh-127572: Fix `test_structmembers` initialization (GH-127577)
Sam Gross [Wed, 4 Dec 2024 08:58:22 +0000 (08:58 +0000)] 
gh-127572: Fix `test_structmembers` initialization (GH-127577)

gh-127572: Fix `test_structmembers` initialization.

The 'C' format code expects an `int` as a destination (not a `char`).
This led to test failures on big-endian platforms like s390x. Use the
'c' format code, which expects a `char` as the destination (but requires
a Python byte objects instead of a str).

11 months agoItertool recipe additions (gh-127483)
Raymond Hettinger [Wed, 4 Dec 2024 00:20:01 +0000 (18:20 -0600)] 
Itertool recipe additions (gh-127483)

11 months agogh-127146: Resolve some minor problems in Emscripten tests (#127565)
Hood Chatham [Wed, 4 Dec 2024 00:06:20 +0000 (01:06 +0100)] 
gh-127146: Resolve some minor problems in Emscripten tests (#127565)

Adjusts some Emscripten test exclusions regarding strftime, fma, and stack depth.

11 months agogh-112192: Increase the trace module coverage precision to one decimal (#126972)
RUANG (James Roy) [Tue, 3 Dec 2024 22:33:13 +0000 (06:33 +0800)] 
gh-112192: Increase the trace module coverage precision to one decimal (#126972)

11 months agogh-115999: Enable specialization of `CALL` instructions in free-threaded builds ...
mpage [Tue, 3 Dec 2024 19:20:20 +0000 (11:20 -0800)] 
gh-115999: Enable specialization of `CALL` instructions in free-threaded builds (#127123)

The CALL family of instructions were mostly thread-safe already and only required a small number of changes, which are documented below.

A few changes were needed to make CALL_ALLOC_AND_ENTER_INIT thread-safe:

Added _PyType_LookupRefAndVersion, which returns the type version corresponding to the returned ref.

Added _PyType_CacheInitForSpecialization, which takes an init method and the corresponding type version and only populates the specialization cache if the current type version matches the supplied version. This prevents potentially caching a stale value in free-threaded builds if we race with an update to __init__.

Only cache __init__ functions that are deferred in free-threaded builds. This ensures that the reference to __init__ that is stored in the specialization cache is valid if the type version guard in _CHECK_AND_ALLOCATE_OBJECT passes.
Fix a bug in _CREATE_INIT_FRAME where the frame is pushed to the stack on failure.

A few other miscellaneous changes were also needed:

Use {LOCK,UNLOCK}_OBJECT in LIST_APPEND. This ensures that the list's per-object lock is held while we are appending to it.

Add missing co_tlbc for _Py_InitCleanup.

Stop/start the world around setting the eval frame hook. This allows us to read interp->eval_frame non-atomically and preserves the behavior of _CHECK_PEP_523 documented below.

11 months agogh-127271: Replace use of PyCell_GET/SET (gh-127272)
Neil Schemenauer [Tue, 3 Dec 2024 18:33:06 +0000 (10:33 -0800)] 
gh-127271: Replace use of PyCell_GET/SET (gh-127272)

* Replace uses of `PyCell_GET` and `PyCell_SET`.  These macros are not
  safe to use in the free-threaded build.  Use `PyCell_GetRef()` and
  `PyCell_SetTakeRef()` instead.

* Since `PyCell_GetRef()` returns a strong rather than borrowed ref, some
  code restructuring was required, e.g. `frame_get_var()` returns a strong
  ref now.

* Add critical sections to `PyCell_GET` and `PyCell_SET`.

* Move critical_section.h earlier in the Python.h file.

* Add `PyCell_GET` to the free-threading howto table of APIs that return
  borrowed refs.

* Add additional unit tests for free-threading.

11 months agogh-115999: Add free-threaded specialization for `SEND` (gh-127426)
Neil Schemenauer [Tue, 3 Dec 2024 18:25:12 +0000 (10:25 -0800)] 
gh-115999: Add free-threaded specialization for `SEND` (gh-127426)

No additional thread safety changes are required.  Note that sending to
a generator that is shared between threads is currently not safe in the
free-threaded build.

11 months agogh-127421: Fix race in test_start_new_thread_failed (#127549)
mpage [Tue, 3 Dec 2024 17:50:58 +0000 (09:50 -0800)] 
gh-127421: Fix race in test_start_new_thread_failed (#127549)

Fix race in test_start_new_thread_failed

When we succeed in starting a new thread, for example if setrlimit
was ineffective, we must wait for the newly spawned thread to exit.
Otherwise, we run the risk that the newly spawned thread will race
with runtime finalization and access memory that has already been
clobbered/freed.

`_thread.start_new_thread()` only spawns daemon threads, which the runtime
does not wait for at shutdown, and does not return a handle. Use
`_thread.start_joinable_thread()` and join the resulting handle when
the thread is started successfully.

11 months agogh-115999: Specialize `LOAD_SUPER_ATTR` in free-threaded builds (gh-127128)
Neil Schemenauer [Tue, 3 Dec 2024 17:32:26 +0000 (09:32 -0800)] 
gh-115999: Specialize `LOAD_SUPER_ATTR` in free-threaded builds (gh-127128)

Use existing helpers to atomically modify the bytecode.  Add unit tests
to ensure specializing is happening as expected.  Add test_specialize.py
that can be used with ThreadSanitizer to detect data races.
Fix thread safety issue with cell_set_contents().

11 months agogh-127347: Document `traceback.print_list` (#127348)
Tomas R. [Tue, 3 Dec 2024 16:08:39 +0000 (17:08 +0100)] 
gh-127347: Document `traceback.print_list` (#127348)

Previously, `traceback.print_list` didn't have a documentation entry and was not exposed in `traceback.__all__`. Now it has a documentation entry and is exposed in `__all__`.

11 months agogh-127255: Make `CopyComPointer` public and add to `ctypes` doc. (GH-127275)
Jun Komoda [Tue, 3 Dec 2024 15:35:08 +0000 (00:35 +0900)] 
gh-127255: Make `CopyComPointer` public and add to `ctypes` doc. (GH-127275)

11 months agogh-117657: TSAN Fix races in `PyMember_Get` and `PyMember_Set` for C extensions ...
Daniele Parmeggiani [Tue, 3 Dec 2024 14:41:53 +0000 (15:41 +0100)] 
gh-117657: TSAN Fix races in `PyMember_Get` and `PyMember_Set` for C extensions (GH-123211)

11 months agogh-126585: Add EHWPOISON error code (#126586)
RUANG (James Roy) [Tue, 3 Dec 2024 12:45:50 +0000 (20:45 +0800)] 
gh-126585: Add EHWPOISON error code (#126586)

11 months agogh-127253: Note that Stable ABI is about ABI stability (GH-127254)
Petr Viktorin [Tue, 3 Dec 2024 12:30:27 +0000 (13:30 +0100)] 
gh-127253: Note that Stable ABI is about ABI stability (GH-127254)

11 months agodocs(logging): fix phrasing from "operation on" to "operate on" (#127543)
Alexander Stepchenko [Tue, 3 Dec 2024 06:52:12 +0000 (09:52 +0300)] 
docs(logging): fix phrasing from "operation on" to "operate on" (#127543)

11 months agoSpeed-up lazy heapq import in collections (gh-127538)
Raymond Hettinger [Tue, 3 Dec 2024 02:45:36 +0000 (20:45 -0600)] 
Speed-up lazy heapq import in collections (gh-127538)

11 months agogh-127111: Emscripten Make web example work again (#127113)
Hood Chatham [Mon, 2 Dec 2024 23:30:24 +0000 (00:30 +0100)] 
gh-127111: Emscripten Make web example work again (#127113)

Moves the Emscripten web example into a standalone folder, and updates
Makefile targets to build the web example. Instructions for usage have
also been added.

11 months agogh-127518: Fix pystats build after #127169 (#127526)
Michael Droettboom [Mon, 2 Dec 2024 20:17:08 +0000 (15:17 -0500)] 
gh-127518: Fix pystats build after #127169 (#127526)

gh-127518: Fix pystats build after #127619

11 months agogh-127521: Mark list as "shared" before resizing if necessary (#127524)
Sam Gross [Mon, 2 Dec 2024 19:38:26 +0000 (19:38 +0000)] 
gh-127521: Mark list as "shared" before resizing if necessary (#127524)

In the free threading build, if a non-owning thread resizes a list,
it must use QSBR to free the old list array because there may be a
concurrent access (without a lock) from the owning thread.

To match the pattern in dictobject.c, we just mark the list as "shared"
before resizing if it's from a non-owning thread and not already marked
as shared.

11 months agogh-127411: Fix invalid conversion of load of TLBC array when compiled in C++ (#127466)
mpage [Mon, 2 Dec 2024 18:13:30 +0000 (10:13 -0800)] 
gh-127411: Fix invalid conversion of load of TLBC array when compiled in C++ (#127466)

Cast the result of the load to the correct type

11 months agogh-126876: Fix test_socket.testLargeTimeout() for missing _testcapi (#127517)
Victor Stinner [Mon, 2 Dec 2024 15:51:50 +0000 (16:51 +0100)] 
gh-126876: Fix test_socket.testLargeTimeout() for missing _testcapi (#127517)

11 months agogh-115999: Use light-weight lock for UNPACK_SEQUENCE_LIST (gh-127514)
Donghee Na [Mon, 2 Dec 2024 15:14:40 +0000 (00:14 +0900)] 
gh-115999: Use light-weight lock for UNPACK_SEQUENCE_LIST (gh-127514)

11 months agogh-101100: Fix Sphinx warnings about list methods (#127054)
Yuki Kobayashi [Mon, 2 Dec 2024 13:51:35 +0000 (22:51 +0900)] 
gh-101100: Fix Sphinx warnings about list methods (#127054)

11 months agogh-109523: Raise a BlockingIOError if reading text from a non-blocking stream cannot...
Giovanni Siragusa [Mon, 2 Dec 2024 13:18:30 +0000 (14:18 +0100)] 
gh-109523: Raise a BlockingIOError if reading text from a non-blocking stream cannot immediately return bytes. (GH-122933)

11 months agogh-126618: fix repr(itertools.count(sys.maxsize)) (#127048)
Sergey B Kirpichev [Mon, 2 Dec 2024 13:14:40 +0000 (16:14 +0300)] 
gh-126618: fix repr(itertools.count(sys.maxsize)) (#127048)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 months agogh-126890: Restore stripped `ssl` docstrings (GH-127281)
Peter Bierma [Mon, 2 Dec 2024 12:50:34 +0000 (07:50 -0500)] 
gh-126890: Restore stripped `ssl` docstrings (GH-127281)

11 months agoFix Unicode encode_wstr_utf8() (#127420)
Victor Stinner [Mon, 2 Dec 2024 10:14:47 +0000 (11:14 +0100)] 
Fix Unicode encode_wstr_utf8() (#127420)

Raise RuntimeError instead of RuntimeWarning.

11 months agoGH-126491: GC: Mark objects reachable from roots before doing cycle collection (GH...
Mark Shannon [Mon, 2 Dec 2024 10:12:17 +0000 (10:12 +0000)] 
GH-126491: GC: Mark objects reachable from roots before doing cycle collection (GH-127110)

* Mark almost all reachable objects before doing collection phase

* Add stats for objects marked

* Visit new frames before each increment

* Update docs

* Clearer calculation of work to do.

11 months agoadd missing gc_collect() calls in sqlite3 tests (#127446)
CF Bolz-Tereick [Mon, 2 Dec 2024 10:11:28 +0000 (11:11 +0100)] 
add missing gc_collect() calls in sqlite3 tests (#127446)

11 months agogh-127443: Fix some entries in `Doc/data/refcounts.dat` (#127451)
Bénédikt Tran [Mon, 2 Dec 2024 08:21:00 +0000 (09:21 +0100)] 
gh-127443: Fix some entries in `Doc/data/refcounts.dat` (#127451)

Fix incorrect entries in `Doc/data/refcounts.dat`