]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
10 months agogh-126907: make `atexit` thread safe in free-threading (#127935)
Peter Bierma [Mon, 16 Dec 2024 19:31:44 +0000 (14:31 -0500)] 
gh-126907: make `atexit` thread safe in free-threading (#127935)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
10 months agogh-127085: fix some data races in memoryview in free-threading (#127412)
Edward Xu [Mon, 16 Dec 2024 19:12:19 +0000 (03:12 +0800)] 
gh-127085: fix some data races in memoryview in free-threading (#127412)

10 months agoRevert "gh-127586: properly restore blocked signals in resource_tracker.py (GH-127587...
Hugo van Kemenade [Mon, 16 Dec 2024 18:18:02 +0000 (20:18 +0200)] 
Revert "gh-127586: properly restore blocked signals in resource_tracker.py (GH-127587)" (#127983)

This reverts commit 46006a1b355f75d06c10e7b8086912c483b34487.

10 months agoFix typo in itertools docs (gh-127995)
Gugubo [Mon, 16 Dec 2024 17:08:25 +0000 (18:08 +0100)] 
Fix typo in itertools docs (gh-127995)

10 months agogh-127864: Fix compiler warning (-Wstringop-truncation) (GH-127878)
Tomas R. [Mon, 16 Dec 2024 16:57:18 +0000 (17:57 +0100)] 
gh-127864: Fix compiler warning (-Wstringop-truncation) (GH-127878)

10 months agogh-127896: Add missing documentation of `PySequence_In` (GH-127979)
Yuki Kobayashi [Mon, 16 Dec 2024 13:56:04 +0000 (22:56 +0900)] 
gh-127896: Add missing documentation of `PySequence_In` (GH-127979)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
10 months agogh-111178: fix UBSan failures in `_elementtree.c` (#127982)
Bénédikt Tran [Mon, 16 Dec 2024 13:40:26 +0000 (14:40 +0100)] 
gh-111178: fix UBSan failures in `_elementtree.c` (#127982)

10 months agogh-125588: Allow to regenerate the parser with Python < 3.12 (#127969)
Pablo Galindo Salgado [Sun, 15 Dec 2024 23:17:01 +0000 (23:17 +0000)] 
gh-125588: Allow to regenerate the parser with Python < 3.12 (#127969)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
10 months agoGH-126985: Don't override venv detection with PYTHONHOME (#127968)
Filipe Laíns 🇵🇸 [Sun, 15 Dec 2024 21:12:13 +0000 (21:12 +0000)] 
GH-126985: Don't override venv detection with PYTHONHOME (#127968)

10 months agogh-127586: properly restore blocked signals in resource_tracker.py (GH-127587)
Stephen Hansen [Sun, 15 Dec 2024 19:53:22 +0000 (14:53 -0500)] 
gh-127586: properly restore blocked signals in resource_tracker.py (GH-127587)

* Correct pthread_sigmask in resource_tracker to restore old signals

Using SIG_UNBLOCK to remove blocked "ignored signals" may accidentally
cause side effects if the calling parent already had said signals
blocked to begin with and did not intend to unblock them when
creating a pool. Use SIG_SETMASK instead with the previous mask of
blocked signals to restore the original blocked set.

* Adding resource_tracker blocked signals test

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
10 months agogh-119786: Fix miscellaneous typos in `InternalDocs/interpreter_definition.md` (...
Stan Ulbrych [Sun, 15 Dec 2024 17:11:50 +0000 (17:11 +0000)] 
gh-119786: Fix miscellaneous typos in `InternalDocs/interpreter_definition.md` (#127957)

10 months agogetpath: Add comments highlighing details of the pyvenv.cfg detection (#127966)
Filipe Laíns 🇵🇸 [Sun, 15 Dec 2024 15:40:19 +0000 (15:40 +0000)] 
getpath: Add comments highlighing details of the pyvenv.cfg detection (#127966)

10 months agogh-127599: Fix _Py_RefcntAdd missing calls to _Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL...
Ed Nutting [Sun, 15 Dec 2024 13:51:03 +0000 (14:51 +0100)] 
gh-127599: Fix _Py_RefcntAdd missing calls to _Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC (#127717)

Previously, `_Py_RefcntAdd` hasn't called
`_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect.

Now it has been fixed.

10 months agoClarify ast docs to use a less confusing example for `ast.ParamSpec` (#127955)
Steve C [Sun, 15 Dec 2024 12:28:43 +0000 (07:28 -0500)] 
Clarify ast docs to use a less confusing example for `ast.ParamSpec` (#127955)

Fix typo in ast docs: ParamSpec defaults

10 months agogh-127353: Allow to force color output on Windows V2 (#127926)
Andrey Efremov [Sat, 14 Dec 2024 15:25:49 +0000 (22:25 +0700)] 
gh-127353: Allow to force color output on Windows V2 (#127926)

10 months agogh-127852: add remark about ',' separator (#127854)
Sergey B Kirpichev [Sat, 14 Dec 2024 13:28:26 +0000 (16:28 +0300)] 
gh-127852: add remark about ',' separator (#127854)

Specify that it is valid for floats and ints with 'd' presentation and an error otherwise.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
10 months agoFix typo in docstring: quadruple double quotes (#127913)
Totosuki [Sat, 14 Dec 2024 07:38:54 +0000 (16:38 +0900)] 
Fix typo in docstring: quadruple double quotes (#127913)

10 months agogh-127747: Resolve BytesWarning in test.support.strace_helper (#127849)
Cody Maloney [Sat, 14 Dec 2024 07:36:47 +0000 (23:36 -0800)] 
gh-127747: Resolve BytesWarning in test.support.strace_helper (#127849)

The strace_helper code has a _make_error function to simplify making
StraceResult objects in error cases. That takes a details parameter
which is either a caught OSError or `bytes`. If it's bytes, _make_error
would implicitly coerce that to a str inside of a f-string, resulting in
 a BytesWarning.

It's useful to see if it's an OSError or bytes when debugging, resolve
by changing to format with repr().

This is an error message on an internal helper.

A non-zero exit code occurs if the strace binary isn't found, and no
events will be parsed in that case (there is no output). Handle that
case by checking exit code before checking for events.

Still asserting around events rather than returning false, so that
hopefully if there's some change to `strace` that breaks the parsing,
will see that as a test failure rather than silently loosing strace
tests because they are auto-disabled.

10 months agogh-115999: Specialize loading attributes from modules in free-threaded builds (#127711)
mpage [Fri, 13 Dec 2024 18:17:16 +0000 (10:17 -0800)] 
gh-115999: Specialize loading attributes from modules in free-threaded builds (#127711)

We use the same approach that was used for specialization of LOAD_GLOBAL in free-threaded builds:

_CHECK_ATTR_MODULE is renamed to _CHECK_ATTR_MODULE_PUSH_KEYS; it pushes the keys object for the following _LOAD_ATTR_MODULE_FROM_KEYS (nee _LOAD_ATTR_MODULE). This arrangement avoids having to recheck the keys version.

_LOAD_ATTR_MODULE is renamed to _LOAD_ATTR_MODULE_FROM_KEYS; it loads the value from the keys object pushed by the preceding _CHECK_ATTR_MODULE_PUSH_KEYS at the cached index.

10 months agoMinor readability improvements for the itertools recipes (gh-127928)
Raymond Hettinger [Fri, 13 Dec 2024 18:12:49 +0000 (12:12 -0600)] 
Minor readability improvements for the itertools recipes (gh-127928)

10 months agogh-126024: unicodeobject: optimize find_first_nonascii (GH-127790)
Inada Naoki [Fri, 13 Dec 2024 16:21:46 +0000 (01:21 +0900)] 
gh-126024: unicodeobject: optimize find_first_nonascii (GH-127790)

Remove 1 branch.

10 months agogh-127691: add type checks when using `PyUnicodeError` objects (GH-127694)
Bénédikt Tran [Fri, 13 Dec 2024 16:16:22 +0000 (17:16 +0100)] 
gh-127691: add type checks when using `PyUnicodeError` objects (GH-127694)

10 months agogh-102471, PEP 757: Add PyLong import and export API (#121339)
Victor Stinner [Fri, 13 Dec 2024 13:24:48 +0000 (14:24 +0100)] 
gh-102471, PEP 757: Add PyLong import and export API (#121339)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
10 months agogh-127906: Test the limited C API in test_cppext (#127916)
Victor Stinner [Fri, 13 Dec 2024 13:23:20 +0000 (14:23 +0100)] 
gh-127906: Test the limited C API in test_cppext (#127916)

10 months agogh-127870: Detect recursive calls in ctypes _as_parameter_ handling (#127872)
Victor Stinner [Fri, 13 Dec 2024 12:53:47 +0000 (13:53 +0100)] 
gh-127870: Detect recursive calls in ctypes _as_parameter_ handling (#127872)

10 months agoGH-126833: Dumps graphviz representation of executor graph. (GH-126880)
Mark Shannon [Fri, 13 Dec 2024 11:00:00 +0000 (11:00 +0000)] 
GH-126833: Dumps graphviz representation of executor graph. (GH-126880)

10 months agogh-126868: Add freelist for compact int objects (GH-126865)
Pieter Eendebak [Fri, 13 Dec 2024 10:06:26 +0000 (11:06 +0100)] 
gh-126868: Add freelist for compact int objects (GH-126865)

10 months agoGH-125174: Don't use `UINT32_MAX` in header file (GH-127863)
Mark Shannon [Fri, 13 Dec 2024 09:54:59 +0000 (09:54 +0000)] 
GH-125174: Don't use `UINT32_MAX` in header file (GH-127863)

10 months agolink to the correct output method in documentation (#127857)
Viktor Kálmán [Fri, 13 Dec 2024 09:27:02 +0000 (10:27 +0100)] 
link to the correct output method in documentation (#127857)

10 months agoDocument PyObject_SelfIter (#127861)
Miro Hrončok [Fri, 13 Dec 2024 09:26:22 +0000 (10:26 +0100)] 
Document PyObject_SelfIter (#127861)

10 months agogh-127845: Minor improvements to iOS test runner script (#127846)
Russell Keith-Magee [Thu, 12 Dec 2024 21:49:02 +0000 (05:49 +0800)] 
gh-127845: Minor improvements to iOS test runner script (#127846)

Uses symlinks to install iOS framework into testbed clone, adds a verbose mode
to the iOS runner to hide most Xcode output, adds another mechanism to disable
terminal colors, and ensures that stdout is flushed after every write.

10 months agoFix typo in traceback docs (#127884)
Daniel Haag [Thu, 12 Dec 2024 21:43:44 +0000 (22:43 +0100)] 
Fix typo in traceback docs (#127884)

10 months agoGH-127724: don't use sysconfig to calculate the venv local include path (#127731)
Filipe Laíns 🇵🇸 [Thu, 12 Dec 2024 21:41:46 +0000 (21:41 +0000)] 
GH-127724: don't use sysconfig to calculate the venv local include path (#127731)

10 months agoRevert "gh-127353: Allow to force color output on Windows (#127354)" (#127889)
Hugo van Kemenade [Thu, 12 Dec 2024 21:11:20 +0000 (23:11 +0200)] 
Revert "gh-127353: Allow to force color output on Windows (#127354)" (#127889)

This reverts commit 365451e28368db46ae89a3a990d85c10c2284aa2.

10 months agoFix typos in `Lib/_pydecimal.py` (#127700)
Stan Ulbrych [Thu, 12 Dec 2024 20:27:29 +0000 (20:27 +0000)] 
Fix typos in `Lib/_pydecimal.py` (#127700)

10 months agogh-127353: Allow to force color output on Windows (#127354)
Andrey Efremov [Thu, 12 Dec 2024 20:17:39 +0000 (03:17 +0700)] 
gh-127353: Allow to force color output on Windows (#127354)

10 months agogh-127865: Fix build failure for systems without thread local support (GH-127866)
velemas [Thu, 12 Dec 2024 18:07:55 +0000 (20:07 +0200)] 
gh-127865: Fix build failure for systems without thread local support (GH-127866)

This PR fixes the build issue introduced by the commit 628f6eb from
GH-112207 on systems without thread local support.

10 months agogh-127879: Fix data race in `_PyFreeList_Push` (#127880)
Sam Gross [Thu, 12 Dec 2024 17:59:13 +0000 (17:59 +0000)] 
gh-127879: Fix data race in `_PyFreeList_Push` (#127880)

Writes to the `ob_tid` field need to use atomics because it may be
concurrently read by a non-locking dictionary, list, or structmember
read.

10 months agoGH-127807: pathlib ABCs: remove `PathBase._unsupported_msg()` (#127855)
Barney Gale [Thu, 12 Dec 2024 17:39:24 +0000 (17:39 +0000)] 
GH-127807: pathlib ABCs: remove `PathBase._unsupported_msg()` (#127855)

This method helped us customise the `UnsupportedOperation` message
depending on the type. But we're aiming to make `PathBase` a proper ABC
soon, so `NotImplementedError` is the right exception to raise there.

10 months agoGH-125174: Fix compiler warning (GH-127860)
Mark Shannon [Thu, 12 Dec 2024 11:22:20 +0000 (11:22 +0000)] 
GH-125174: Fix compiler warning (GH-127860)

Fix compiler warning

10 months agoGH-127381: pathlib ABCs: remove remaining uncommon `PathBase` methods (#127714)
Barney Gale [Thu, 12 Dec 2024 06:49:34 +0000 (06:49 +0000)] 
GH-127381: pathlib ABCs: remove remaining uncommon `PathBase` methods (#127714)

Remove the following methods from `pathlib._abc.PathBase`:

- `expanduser()`
- `hardlink_to()`
- `touch()`
- `chmod()`
- `lchmod()`
- `owner()`
- `group()`
- `from_uri()`
- `as_uri()`

These operations aren't regularly supported in virtual filesystems, so they
don't win a place in the `PathBase` interface. (Some of them probably don't
deserve a place in `Path` :P.) They're quasi-abstract (except `lchmod()`),
and they're not called by other `PathBase` methods.

10 months agoSimplify and speed-up an itertools recipe (gh-127848)
Raymond Hettinger [Thu, 12 Dec 2024 03:24:56 +0000 (21:24 -0600)] 
Simplify and speed-up an itertools recipe (gh-127848)

10 months agogh-127740: Add some more tests for earlier PR #127756 (#127818)
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) [Thu, 12 Dec 2024 02:18:12 +0000 (07:48 +0530)] 
gh-127740: Add some more tests for earlier PR #127756 (#127818)

10 months agogh-127146: Some expected failures in Emscripten time tests (#127843)
Hood Chatham [Thu, 12 Dec 2024 01:11:00 +0000 (02:11 +0100)] 
gh-127146: Some expected failures in Emscripten time tests (#127843)

Disables two tests in the test_time suite, and adjusts test_os to reflect
precision limits in Emscripten.

10 months agogh-115999: Specialize `CALL_KW` in free-threaded builds (#127713)
mpage [Wed, 11 Dec 2024 23:18:22 +0000 (15:18 -0800)] 
gh-115999: Specialize `CALL_KW` in free-threaded builds (#127713)

* Enable specialization of CALL_KW

* Fix bug pushing frame in _PY_FRAME_KW

`_PY_FRAME_KW` pushes a pointer to the new frame onto the stack for
consumption by the next uop. When pushing the frame fails, we do not
want to push the result, `NULL`, to the stack because it is not
a valid stackref. This works in the default build because `PyStackRef_NULL`
 and `NULL` are the same value, so the `PyStackRef_XCLOSE()` in the error
handler ignores it. In the free-threaded build the values are not the same;
`PyStackRef_XCLOSE()` will attempt to decref a null pointer.

10 months agogh-111609: Test `end_offset` in SyntaxError subclass (#127830)
Nice Zombies [Wed, 11 Dec 2024 18:32:54 +0000 (19:32 +0100)] 
gh-111609: Test `end_offset` in SyntaxError subclass (#127830)

Test `end_offset` in SyntaxError subclass

10 months agoGH-125174: Mark objects as statically allocated. (#127797)
Mark Shannon [Wed, 11 Dec 2024 17:37:38 +0000 (17:37 +0000)] 
GH-125174: Mark objects as statically allocated. (#127797)

* Set a bit in the unused part of the refcount on 64 bit machines and the free-threaded build.

* Use the top of the refcount range on 32 bit machines

10 months agogh-118915: C API: Document frame locals proxies. (#127720)
Peter Bierma [Wed, 11 Dec 2024 16:28:44 +0000 (11:28 -0500)] 
gh-118915: C API: Document frame locals proxies. (#127720)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
10 months agogh-127065: Make methodcaller thread-safe and re-entrant (GH-127746)
Pieter Eendebak [Wed, 11 Dec 2024 15:06:07 +0000 (16:06 +0100)] 
gh-127065: Make methodcaller thread-safe and re-entrant (GH-127746)

The function `operator.methodcaller` was not thread-safe since the additional
of the vectorcall method in gh-89013. In the free threading build the issue
is easy to trigger, for the normal build harder.

This makes the `methodcaller` safe by:

* Replacing the lazy initialization with initialization in the constructor.
* Using a stack allocated space for the vectorcall arguments and falling back
  to `tp_call` for calls with more than 8 arguments.

10 months agoGH-127058: Make `PySequence_Tuple` safer and probably faster. (#127758)
Mark Shannon [Wed, 11 Dec 2024 14:02:59 +0000 (14:02 +0000)] 
GH-127058: Make `PySequence_Tuple` safer and probably faster. (#127758)

* Use a small buffer, then list when constructing a tuple from an arbitrary sequence.

10 months agogh-123401: Fix http.cookies module to support obsolete RFC 850 date format (#123405)
Nano [Wed, 11 Dec 2024 13:28:19 +0000 (21:28 +0800)] 
gh-123401: Fix http.cookies module to support obsolete RFC 850 date format (#123405)

Co-authored-by: Wulian <1055917385@qq.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
10 months agoCI: Use bash to properly expand variable (#127822)
Hugo van Kemenade [Wed, 11 Dec 2024 12:57:51 +0000 (14:57 +0200)] 
CI: Use bash to properly expand variable (#127822)

10 months agogh-126992: Change pickle code to base 10 for load_long and load_int (GH-127042)
Justin Applegate [Wed, 11 Dec 2024 12:37:59 +0000 (05:37 -0700)] 
gh-126992: Change pickle code to base 10 for load_long and load_int (GH-127042)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
10 months agogh-127791: Fix, document, and test `PyUnstable_AtExit` (#127793)
Peter Bierma [Wed, 11 Dec 2024 11:14:04 +0000 (06:14 -0500)] 
gh-127791: Fix, document, and test `PyUnstable_AtExit` (#127793)

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>
10 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)

10 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.

10 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>
10 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)

10 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)

10 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.

10 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.

10 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.

10 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)