]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
18 months agogh-115009: Update macOS installer to use SQLite 3.45.3 (#117443)
Mariusz Felisiak [Wed, 17 Apr 2024 11:59:38 +0000 (13:59 +0200)] 
gh-115009: Update macOS installer to use SQLite 3.45.3 (#117443)

18 months agobpo-40944: Fix IndexError when parse emails with truncated Message-ID, address, route...
Ivan Savin [Wed, 17 Apr 2024 10:14:22 +0000 (14:14 +0400)] 
bpo-40944: Fix IndexError when parse emails with truncated Message-ID, address, routes, etc (GH-20790)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
18 months agoGH-117760: Streamline the trashcan mechanism (GH-117763)
Mark Shannon [Wed, 17 Apr 2024 10:08:05 +0000 (11:08 +0100)] 
GH-117760: Streamline the trashcan mechanism (GH-117763)

18 months agogh-65824: Add "Help on ..." to the "less" prompt in pydoc (GH-116183)
Serhiy Storchaka [Wed, 17 Apr 2024 10:05:22 +0000 (13:05 +0300)] 
gh-65824: Add "Help on ..." to the "less" prompt in pydoc (GH-116183)

18 months agogh-73231: Update documentation for PyErr_SetFromWindowsErr() (GH-117226)
Serhiy Storchaka [Wed, 17 Apr 2024 10:03:26 +0000 (13:03 +0300)] 
gh-73231: Update documentation for PyErr_SetFromWindowsErr() (GH-117226)

18 months agogh-117313: Fix re-folding email messages containing non-standard line separators...
Serhiy Storchaka [Wed, 17 Apr 2024 10:00:25 +0000 (13:00 +0300)] 
gh-117313: Fix re-folding email messages containing non-standard line separators (GH-117369)

Only treat '\n', '\r' and '\r\n' as line separators in re-folding the email
messages.  Preserve control characters '\v', '\f', '\x1c', '\x1d' and '\x1e'
and Unicode line separators '\x85', '\u2028' and '\u2029' as is.

18 months agogh-117394: Speed up os.path.ismount() on Posix (GH-117447)
Serhiy Storchaka [Wed, 17 Apr 2024 09:58:19 +0000 (12:58 +0300)] 
gh-117394: Speed up os.path.ismount() on Posix (GH-117447)

It is now 2-3 times faster if the user has permissions.

18 months agogh-117503: Fix support of non-ASCII user names in posixpath.expanduser() (GH-117504)
Serhiy Storchaka [Wed, 17 Apr 2024 09:53:40 +0000 (12:53 +0300)] 
gh-117503: Fix support of non-ASCII user names in posixpath.expanduser() (GH-117504)

They are now supported in bytes paths as well as in string paths.

18 months agogh-117907: Fix test_inspect for the build with enabled tracing references (GH-117922)
Serhiy Storchaka [Wed, 17 Apr 2024 09:50:49 +0000 (12:50 +0300)] 
gh-117907: Fix test_inspect for the build with enabled tracing references (GH-117922)

18 months agogh-117879: Fix test_httpservers for the build with profiling (GH-117932)
Serhiy Storchaka [Wed, 17 Apr 2024 09:50:07 +0000 (12:50 +0300)] 
gh-117879: Fix test_httpservers for the build with profiling (GH-117932)

18 months agogh-117845: Detect libedit hook function signature in configure (#117870)
Joshua Root [Wed, 17 Apr 2024 09:26:10 +0000 (19:26 +1000)] 
gh-117845: Detect libedit hook function signature in configure (#117870)

Older libedit versions (like Apple's) use a different type signature
for rl_startup_hook and rl_pre_input_hook. Add a configure check to
determine which signature is accepted by introducing the
Py_RL_STARTUP_HOOK_TAKES_ARGS macro in pyconfig.h.

18 months agogh-86650: Fix IndexError when parse emails with invalid Message-ID (GH-117934)
Serhiy Storchaka [Wed, 17 Apr 2024 07:44:41 +0000 (10:44 +0300)] 
gh-86650: Fix IndexError when parse emails with invalid Message-ID (GH-117934)

In particularly, one-off addresses generated by Microsoft Outlook:
https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/one-off-addresses

Co-authored-by: fsc-eriker <72394365+fsc-eriker@users.noreply.github.com>
18 months agogh-75171: Fix parsing invalid email address headers starting or ending with a dot...
tsufeki [Wed, 17 Apr 2024 07:39:15 +0000 (09:39 +0200)] 
gh-75171: Fix parsing invalid email address headers starting or ending with a dot (GH-15600)

Co-authored-by: Tim Bell <timothybell@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
18 months agogh-117923: Catch ``test_webbrowser.test_parse_args_error`` stderr output (#117924)
Kirill Podoprigora [Wed, 17 Apr 2024 07:25:05 +0000 (10:25 +0300)] 
gh-117923: Catch ``test_webbrowser.test_parse_args_error`` stderr output (#117924)

18 months agogh-71966: Move the module docstring from _pydecimal to decimal (GH-117919)
Serhiy Storchaka [Wed, 17 Apr 2024 07:18:24 +0000 (10:18 +0300)] 
gh-71966: Move the module docstring from _pydecimal to decimal (GH-117919)

Now it is set even if the C implementation is used.

Also add a one-line synopsis.

18 months agogh-117945: Fix `os.path.ismount()` documentation (#117947)
Nice Zombies [Tue, 16 Apr 2024 22:55:53 +0000 (00:55 +0200)] 
gh-117945: Fix `os.path.ismount()` documentation (#117947)

18 months agolinecache: Fix docstring location (#117948)
Jelle Zijlstra [Tue, 16 Apr 2024 22:37:18 +0000 (15:37 -0700)] 
linecache: Fix docstring location (#117948)

gh-117501 put some code before the docstring, so now it is no longer
recognized as a docstring.

18 months agogh-112844: Fix xz CPE identifier (GH-117656)
Seth Michael Larson [Tue, 16 Apr 2024 22:11:43 +0000 (17:11 -0500)] 
gh-112844: Fix xz CPE identifier (GH-117656)

18 months agogh-115009: Update Windows installer to use SQLite 3.45.3 (GH-117445)
Mariusz Felisiak [Tue, 16 Apr 2024 22:10:05 +0000 (00:10 +0200)] 
gh-115009: Update Windows installer to use SQLite 3.45.3 (GH-117445)

18 months agogh-117645: Increase WASI stack size from 512 KiB to 8 MiB (#117674)
Victor Stinner [Tue, 16 Apr 2024 21:26:54 +0000 (23:26 +0200)] 
gh-117645: Increase WASI stack size from 512 KiB to 8 MiB (#117674)

Increase also the initial memory from 10 MiB to 20 MiB.

Reenable test_dynamic on WASI build.

18 months agogh-117755: Fix mimalloc for huge allocation on s390x (#117809)
Victor Stinner [Tue, 16 Apr 2024 20:34:12 +0000 (22:34 +0200)] 
gh-117755: Fix mimalloc for huge allocation on s390x (#117809)

Fix mimalloc allocator for huge memory allocation (around
8,589,934,592 GiB) on s390x.

Abort allocation early in mimalloc if the number of slices doesn't
fit into uint32_t, to prevent a integer overflow (cast 64-bit
size_t to uint32_t).

18 months agogh-117755: Remove tests on huge memory allocations (#117938)
Victor Stinner [Tue, 16 Apr 2024 20:05:12 +0000 (22:05 +0200)] 
gh-117755: Remove tests on huge memory allocations (#117938)

Remove unreliable tests on huge memory allocations:

* Remove test_maxcontext_exact_arith() of test_decimal.
  Stefan Krah, test author, agreed on removing the test:
  https://github.com/python/cpython/issues/114331#issuecomment-1925731273
* Remove test_constructor() tests of test_io.
  Sam Gross suggests remove them:
  https://github.com/python/cpython/pull/117809#pullrequestreview-2003889558

On Linux, depending how overcommit is configured, especially on Linux
s390x, a huge memory allocation (half or more of the full address
space) can succeed, but then the process will eat the full system
swap and make the system slower and slower until the whole system
becomes unusable.

Moreover, these tests had to be skipped when Python is built with
sanitizers.

18 months agogh-117376: Make code objects use deferred reference counting (#117823)
Sam Gross [Tue, 16 Apr 2024 16:42:53 +0000 (12:42 -0400)] 
gh-117376: Make code objects use deferred reference counting (#117823)

We want code objects to use deferred reference counting in the
free-threaded build. This requires them to be tracked by the GC, so we
set `Py_TPFLAGS_HAVE_GC` in the free-threaded build, but not the default
build.

18 months agogh-112069: Make setiter_iternext to be thread-safe (gh-117935)
Donghee Na [Tue, 16 Apr 2024 16:31:42 +0000 (01:31 +0900)] 
gh-112069: Make setiter_iternext to be thread-safe (gh-117935)

18 months agoDocs: Add classes to C API return value annotations (#117926)
Hugo van Kemenade [Tue, 16 Apr 2024 15:56:15 +0000 (18:56 +0300)] 
Docs: Add classes to C API return value annotations (#117926)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
18 months agogh-117683: Fix test_free_different_thread failures with GIL disabled (#117685)
Sam Gross [Tue, 16 Apr 2024 15:55:56 +0000 (11:55 -0400)] 
gh-117683: Fix test_free_different_thread failures with GIL disabled (#117685)

18 months agogh-115178: Add Counts of UOp Pairs to pystats (GH-115181)
Jeff Glass [Tue, 16 Apr 2024 13:27:18 +0000 (08:27 -0500)] 
gh-115178: Add Counts of UOp Pairs to pystats (GH-115181)

18 months agoGH-115776: Static object are immortal, so mark them as such. (GH-117673)
Mark Shannon [Tue, 16 Apr 2024 11:51:41 +0000 (12:51 +0100)] 
GH-115776: Static object are immortal, so mark them as such. (GH-117673)

18 months agogh-117691: Add an appropriate stacklevel for PEP-706 tarfile deprecation warnings...
Alex Waygood [Tue, 16 Apr 2024 11:36:00 +0000 (12:36 +0100)] 
gh-117691: Add an appropriate stacklevel for PEP-706 tarfile deprecation warnings (GH-117872)

18 months agogh-117613: Argument Clinic: ensure that 'defining_class' params are positional-only...
neonene [Tue, 16 Apr 2024 09:52:45 +0000 (18:52 +0900)] 
gh-117613: Argument Clinic: ensure that 'defining_class' params are positional-only (#117781)

18 months agogh-102402: Fix floating point math issue by using `time.time_ns()` in `logging.LogRec...
Douglas Thor [Tue, 16 Apr 2024 09:44:57 +0000 (02:44 -0700)] 
gh-102402: Fix floating point math issue by using `time.time_ns()` in `logging.LogRecord` (GH-102412)

18 months agogh-117797: Improve `test_descr.test_not_implemented` (#117798)
Nikita Sobolev [Tue, 16 Apr 2024 09:11:57 +0000 (12:11 +0300)] 
gh-117797: Improve `test_descr.test_not_implemented` (#117798)

18 months agogh-117613: Enhance test_clinic @defining_class tests (#117896)
Victor Stinner [Tue, 16 Apr 2024 07:32:51 +0000 (09:32 +0200)] 
gh-117613: Enhance test_clinic @defining_class tests (#117896)

18 months agogh-77102: site: try utf-8 and fallback to locale encoding when reading .pth file...
Inada Naoki [Tue, 16 Apr 2024 03:56:16 +0000 (12:56 +0900)] 
gh-77102: site: try utf-8 and fallback to locale encoding when reading .pth file (#117802)

18 months agogh-76785: Fix Windows Refleak in test_interpreters (gh-117913)
Eric Snow [Tue, 16 Apr 2024 02:16:37 +0000 (20:16 -0600)] 
gh-76785: Fix Windows Refleak in test_interpreters (gh-117913)

gh-117662 introduced some refleaks, or, rather, exposed some existing refleaks.  The leaks are coming when test.support.os_helper is imported in a "legacy" interpreter.  I've updated test.test_interpreters.utils to avoid importing os_helper, which fixes the leaks.  I'll address the root cause separately.

18 months agogh-117804: Document how to suppress PGO unprofiled source warnings (#117859)
Erlend E. Aasland [Mon, 15 Apr 2024 21:17:28 +0000 (23:17 +0200)] 
gh-117804: Document how to suppress PGO unprofiled source warnings (#117859)

18 months agoDocs: add link roles with Sphinx extlinks (#117850)
Hugo van Kemenade [Mon, 15 Apr 2024 18:22:00 +0000 (21:22 +0300)] 
Docs: add link roles with Sphinx extlinks (#117850)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
18 months agogh-109975: Copyedit "What's New in Python 3.13" (#117902)
Hugo van Kemenade [Mon, 15 Apr 2024 17:20:40 +0000 (20:20 +0300)] 
gh-109975: Copyedit "What's New in Python 3.13" (#117902)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
18 months agogh-117688: Fix deadlock in test_no_stale_references with GIL disabled (#117720)
Sam Gross [Mon, 15 Apr 2024 16:54:56 +0000 (12:54 -0400)] 
gh-117688: Fix deadlock in test_no_stale_references with GIL disabled (#117720)

Check `my_object_collected.wait()` in a loop to give the main thread a
chance to merge the reference count fields. Additionally, call
`my_object_collected.set()` in a background thread to avoid deadlocking
when the destructor is called asynchronously via the eval breaker
within the body of of `my_object_collected.wait()`.

18 months agoDocs: make the `whatsnew-typing-py312` anchor point to things that were new in the...
Alex Waygood [Mon, 15 Apr 2024 16:48:13 +0000 (17:48 +0100)] 
Docs: make the `whatsnew-typing-py312` anchor point to things that were new in the typing module (#117904)

18 months agogh-117657: Quiet more TSAN warnings due to incorrect modeling of compare/exchange...
mpage [Mon, 15 Apr 2024 16:17:55 +0000 (09:17 -0700)] 
gh-117657: Quiet more TSAN warnings due to incorrect modeling of compare/exchange (#117830)

18 months agogh-117657: Quiet TSAN warning about a data race between `start_the_world()` and ...
mpage [Mon, 15 Apr 2024 16:17:33 +0000 (09:17 -0700)] 
gh-117657: Quiet TSAN warning about a data race between `start_the_world()` and `tstate_try_attach()` (#117828)

TSAN erroneously reports a data race between the `_Py_atomic_compare_exchange_int`
on `tstate->state` in `tstate_try_attach()` and the non-atomic load of
`tstate->state` in `start_the_world`. The `_Py_atomic_compare_exchange_int` fails,
but TSAN erroneously treats it as a store.

18 months agogh-117657: Add TSAN suppressions for the free-threaded build (#117736)
mpage [Mon, 15 Apr 2024 16:08:25 +0000 (09:08 -0700)] 
gh-117657: Add TSAN suppressions for the free-threaded build (#117736)

Additionally, reduce the iterations for a few weakref tests that would
otherwise take a prohibitively long amount of time (> 1 hour) when TSAN
is enabled and the GIL is disabled.

18 months agogh-115532: Minor tweaks to kde() (gh-117897)
Raymond Hettinger [Mon, 15 Apr 2024 15:08:21 +0000 (10:08 -0500)] 
gh-115532: Minor tweaks to kde() (gh-117897)

18 months agogh-115664: Reorganize versionadded directives for -X options (GH-116304)
Serhiy Storchaka [Mon, 15 Apr 2024 15:01:17 +0000 (18:01 +0300)] 
gh-115664: Reorganize versionadded directives for -X options (GH-116304)

Add the versionadded directives just under the description of the
corresponding option.

18 months agogh-112278: Improve error handling in wmi module and tests (GH-117818)
Steve Dower [Mon, 15 Apr 2024 14:43:11 +0000 (15:43 +0100)] 
gh-112278: Improve error handling in wmi module and tests (GH-117818)

18 months agogh-90329: Add _winapi.GetLongPathName and GetShortPathName and use in venv to reduce...
Steve Dower [Mon, 15 Apr 2024 14:36:06 +0000 (15:36 +0100)] 
gh-90329: Add _winapi.GetLongPathName and GetShortPathName and use in venv to reduce warnings (GH-117817)

18 months agogh-117889: Fix PGO test in test_peg_generator (#117893)
Victor Stinner [Mon, 15 Apr 2024 13:59:34 +0000 (15:59 +0200)] 
gh-117889: Fix PGO test in test_peg_generator (#117893)

Reuse support.check_cflags_pgo() in test_peg_generator to check for
PGO build.

Log PGO_PROF_USE_FLAG in test.pythoninfo.

18 months agoGH-117750: When clearing object's dict, clear inline values but leave dict attached...
Mark Shannon [Mon, 15 Apr 2024 13:45:05 +0000 (14:45 +0100)] 
GH-117750: When clearing object's dict, clear inline values but leave dict attached (GH-117808)

18 months agoAdd 'The Python 2.3 Method Resolution Order' (#116435)
Hugo van Kemenade [Mon, 15 Apr 2024 10:01:15 +0000 (13:01 +0300)] 
Add 'The Python 2.3 Method Resolution Order' (#116435)

18 months agogh-117694: Improve tests for PyEval_EvalCodeEx() (GH-117695)
Serhiy Storchaka [Mon, 15 Apr 2024 09:44:54 +0000 (12:44 +0300)] 
gh-117694: Improve tests for PyEval_EvalCodeEx() (GH-117695)

18 months agogh-117755: Skip test_io.test_constructor() on s390x (#117801)
Victor Stinner [Mon, 15 Apr 2024 08:24:47 +0000 (10:24 +0200)] 
gh-117755: Skip test_io.test_constructor() on s390x (#117801)

The test allocates 9 223 372 036 854 775 807 bytes
(0x7fffffffffffffff) and mimalloc fails with a division by zero on
s390x.

18 months agogh-117826: Remove lookdict_index from delitemif_lock_held (gh-117869)
Donghee Na [Mon, 15 Apr 2024 05:26:59 +0000 (14:26 +0900)] 
gh-117826: Remove lookdict_index from delitemif_lock_held (gh-117869)

18 months agodocs: typo in 3.13 release notes (#117866)
Galen Rice [Sun, 14 Apr 2024 21:04:59 +0000 (17:04 -0400)] 
docs: typo in 3.13 release notes (#117866)

18 months agogh-117636: Remove redundant type check in `os.path.join()` (#117638)
Nice Zombies [Sun, 14 Apr 2024 21:04:14 +0000 (23:04 +0200)] 
gh-117636: Remove redundant type check in `os.path.join()` (#117638)

18 months agoDoc: mark up classes, attributes, parameters, and methods in dataclasses.rst (#117820)
Erlend E. Aasland [Sun, 14 Apr 2024 16:29:01 +0000 (18:29 +0200)] 
Doc: mark up classes, attributes, parameters, and methods in dataclasses.rst (#117820)

18 months agogh-115692: Add tests to increase `json` coverage (#115693)
Hugo van Kemenade [Sun, 14 Apr 2024 12:11:06 +0000 (15:11 +0300)] 
gh-115692: Add tests to increase `json` coverage (#115693)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
18 months agogh-117348: restore import time performance of configparser (#117703)
Jason R. Coombs [Sun, 14 Apr 2024 11:10:09 +0000 (07:10 -0400)] 
gh-117348: restore import time performance of configparser (#117703)

Reduces import time by over 50% (10431µs vs 4350µs on Apple M3 Pro).

18 months agodataclasses docs: add some link anchors (#117601)
Jelle Zijlstra [Sun, 14 Apr 2024 08:03:16 +0000 (01:03 -0700)] 
dataclasses docs: add some link anchors (#117601)

18 months agoAutoconf: aarch64-apple-darwin/clang is now a tier 1 platform (#117861)
Erlend E. Aasland [Sun, 14 Apr 2024 07:21:29 +0000 (09:21 +0200)] 
Autoconf: aarch64-apple-darwin/clang is now a tier 1 platform (#117861)

See also python/pep#3705

18 months agoSimpler example of shallow dict export of a dataclass (#117812)
Gouvernathor [Sun, 14 Apr 2024 00:14:43 +0000 (02:14 +0200)] 
Simpler example of shallow dict export of a dataclass (#117812)

18 months agoTweak wording for dataclasses.replace (gh-117758)
Gouvernathor [Sun, 14 Apr 2024 00:03:09 +0000 (02:03 +0200)] 
Tweak wording for dataclasses.replace (gh-117758)

18 months agoGH-115060: Speed up `pathlib.Path.glob()` by omitting initial `stat()` (#117831)
Barney Gale [Sat, 13 Apr 2024 23:08:03 +0000 (00:08 +0100)] 
GH-115060: Speed up `pathlib.Path.glob()` by omitting initial `stat()` (#117831)

Since 6258844c, paths that might not exist can be fed into pathlib's
globbing implementation, which will call `os.scandir()` / `os.lstat()` only
when strictly necessary. This allows us to drop an initial `self.is_dir()`
call, which saves a `stat()`.

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
18 months agogh-96398: Fix mpicc check in configure.ac (#117857)
Erlend E. Aasland [Sat, 13 Apr 2024 21:22:06 +0000 (23:22 +0200)] 
gh-96398: Fix mpicc check in configure.ac (#117857)

18 months agogh-68583: webbrowser: replace `getopt` with `argparse`, add long options (#117047)
Hugo van Kemenade [Sat, 13 Apr 2024 14:56:56 +0000 (17:56 +0300)] 
gh-68583: webbrowser: replace `getopt` with `argparse`, add long options (#117047)

18 months agogh-102247: http: support rfc9110 status codes (GH-117611)
Michiel W. Beijen [Sat, 13 Apr 2024 14:33:20 +0000 (16:33 +0200)] 
gh-102247: http: support rfc9110 status codes (GH-117611)

rfc9110 obsoletes the earlier rfc 7231. This document also includes some
status codes that were previously only used for WebDAV and assigns more
generic names to these status codes.

ref: https://www.rfc-editor.org/rfc/rfc9110.html#name-changes-from-rfc-7231

- http.HTTPStatus.CONTENT_TOO_LARGE (413, previously
  REQUEST_ENTITY_TOO_LARGE)
- http.HTTPStatus.URI_TOO_LONG (414, previously REQUEST_URI_TOO_LONG)
- http.HTTPStatus.RANGE_NOT_SATISFYABLE (416, previously
  REQUEST_RANGE_NOT_SATISFYABLE)
- http.HTTPStatus.UNPROCESSABLE_CONTENT (422, previously
  UNPROCESSABLE_ENTITY)

The new constants are added to http.HTTPStatus and the old constant names are
preserved for backwards compatibility.

References in documentation to the obsoleted rfc 7231 are updated

18 months agogh-117840: Fix indent to fix shlex syntax highlighting (#117843)
Hugo van Kemenade [Sat, 13 Apr 2024 11:31:01 +0000 (14:31 +0300)] 
gh-117840: Fix indent to fix shlex syntax highlighting (#117843)

18 months agogh-114466: explicitly define heap invariant (#117778)
Shantanu [Sat, 13 Apr 2024 07:05:27 +0000 (00:05 -0700)] 
gh-114466: explicitly define heap invariant (#117778)

I think the choice of wording in these docs is great and doesn't
need to change. However, it could be useful to explicitly define
this term / the cost of doing so seems relatively low.

18 months agogh-96398: Detect GCC compatible compilers in configure (#117825)
Erlend E. Aasland [Sat, 13 Apr 2024 07:05:07 +0000 (09:05 +0200)] 
gh-96398: Detect GCC compatible compilers in configure (#117825)

Introduce a cached variable $ac_cv_gcc_compat and set it to 'yes' if
the C preprocessor defines the __GNUC__ macro.

18 months agogh-94673: Clarify About Runtime State Related to Static Builtin Types (gh-117761)
Eric Snow [Fri, 12 Apr 2024 22:39:27 +0000 (16:39 -0600)] 
gh-94673: Clarify About Runtime State Related to Static Builtin Types (gh-117761)

Guido pointed out to me that some details about the per-interpreter state for the builtin types aren't especially clear.  I'm addressing that by:

* adding a comment explaining that state
* adding some asserts to point out the relationship between each index and the interp/global runtime state

18 months agoGH-117727: Speed up `pathlib.Path.iterdir()` by using `os.scandir()` (#117728)
Barney Gale [Fri, 12 Apr 2024 22:02:39 +0000 (23:02 +0100)] 
GH-117727: Speed up `pathlib.Path.iterdir()` by using `os.scandir()` (#117728)

Replace use of `os.listdir()` with `os.scandir()`. Forgo setting `_drv`,
`_root` and `_tail_cached`, as these usually aren't needed. Use
`os.DirEntry.path` to set `_str`.

18 months agoGH-115060: Speed up `pathlib.Path.glob()` by not scanning literal parts (#117732)
Barney Gale [Fri, 12 Apr 2024 21:19:21 +0000 (22:19 +0100)] 
GH-115060: Speed up `pathlib.Path.glob()` by not scanning literal parts (#117732)

Don't bother calling `os.scandir()` to scan for literal pattern segments,
like `foo` in `foo/*.py`. Instead, append the segment(s) as-is and call
through to the next selector with `exists=False`, which signals that the
path might not exist. Subsequent selectors will call `os.scandir()` or
`os.lstat()` to filter out missing paths as needed.

18 months agogh-115627: Fix ssl test_pha_required_nocert() (#117821)
Victor Stinner [Fri, 12 Apr 2024 18:41:16 +0000 (20:41 +0200)] 
gh-115627: Fix ssl test_pha_required_nocert() (#117821)

Accept also BrokenPipeError error message.

18 months agogh-117739: Update definition of global interpreter lock for 3.13 (#117740)
Savannah Ostrowski [Fri, 12 Apr 2024 18:19:41 +0000 (11:19 -0700)] 
gh-117739: Update definition of global interpreter lock for 3.13  (#117740)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
18 months agogh-117376: Partial implementation of deferred reference counting (#117696)
Sam Gross [Fri, 12 Apr 2024 17:36:20 +0000 (13:36 -0400)] 
gh-117376: Partial implementation of deferred reference counting (#117696)

This marks objects as using deferred refrence counting using the
`ob_gc_bits` field in the free-threaded build and collects those objects
during GC.

18 months agogh-117764: Add more tests for signatures of builtins (GH-117816)
Serhiy Storchaka [Fri, 12 Apr 2024 14:55:29 +0000 (17:55 +0300)] 
gh-117764: Add more tests for signatures of builtins (GH-117816)

Test signatures of all public builtins and methods of builtin classes
in modules builtins, types, sys, and several other modules (either
included in the list of standard builtin modules sys.builtin_module_names,
or providing a public interface for such modules).

Most builtins should have supported signatures, with few known exceptions.
When more builtins will be converted to Argument Clinic or support of
new signatures be implemented, they will be removed from the exception
lists.

18 months agogh-96398: Detect emcc and mpicc in compiler names in configure (#117819)
Erlend E. Aasland [Fri, 12 Apr 2024 14:33:29 +0000 (16:33 +0200)] 
gh-96398: Detect emcc and mpicc in compiler names in configure (#117819)

- emcc defines __EMSCRIPTEN__
- mpicc doesn't define anything in particular; detect it using basename

18 months agogh-117764: Add docstrings and signatures for the types of None, Ellipsis and NotImple...
Serhiy Storchaka [Fri, 12 Apr 2024 12:45:23 +0000 (15:45 +0300)] 
gh-117764: Add docstrings and signatures for the types of None, Ellipsis and NotImplemented (GH-117813)

18 months agogh-117764: Use Argument Clinic for signal.set_wakeup_fd() (GH-117777)
Serhiy Storchaka [Fri, 12 Apr 2024 11:21:00 +0000 (14:21 +0300)] 
gh-117764: Use Argument Clinic for signal.set_wakeup_fd() (GH-117777)

18 months agogh-117764: Fix and add signatures for many builtins (GH-117769)
Serhiy Storchaka [Fri, 12 Apr 2024 10:56:41 +0000 (13:56 +0300)] 
gh-117764: Fix and add signatures for many builtins (GH-117769)

18 months agoFix version directive indents (#117719)
Hugo van Kemenade [Fri, 12 Apr 2024 10:30:42 +0000 (13:30 +0300)] 
Fix version directive indents (#117719)

18 months agogh-117764: Add signatures for functions in the faulthandler module (GH-117771)
Serhiy Storchaka [Fri, 12 Apr 2024 10:14:31 +0000 (13:14 +0300)] 
gh-117764: Add signatures for functions in the faulthandler module (GH-117771)

18 months agogh-117764: Add signature for functools.partial() (GH-117775)
Serhiy Storchaka [Fri, 12 Apr 2024 10:00:38 +0000 (13:00 +0300)] 
gh-117764: Add signature for functools.partial() (GH-117775)

18 months agogh-117764: Add signatures and improve docstrings in the _thread module (GH-117772)
Serhiy Storchaka [Fri, 12 Apr 2024 09:49:59 +0000 (12:49 +0300)] 
gh-117764: Add signatures and improve docstrings in the _thread module (GH-117772)

18 months agogh-117752: Autoconf: fix PGO builds for 'make -C build' incantations (#117803)
Erlend E. Aasland [Fri, 12 Apr 2024 09:36:40 +0000 (11:36 +0200)] 
gh-117752: Autoconf: fix PGO builds for 'make -C build' incantations (#117803)

18 months agogh-117764: Add signatures for some objects in the itertools module (GH-117774)
Serhiy Storchaka [Fri, 12 Apr 2024 09:36:27 +0000 (12:36 +0300)] 
gh-117764: Add signatures for some objects in the itertools module (GH-117774)

18 months agogh-117764: Add signatures in the atexit module (GH-117776)
Serhiy Storchaka [Fri, 12 Apr 2024 09:35:56 +0000 (12:35 +0300)] 
gh-117764: Add signatures in the atexit module (GH-117776)

18 months agogh-117764: Add signatures for __reduce__ and __reduce_ex__ in the _io module (GH...
Serhiy Storchaka [Fri, 12 Apr 2024 09:22:17 +0000 (12:22 +0300)] 
gh-117764: Add signatures for __reduce__ and __reduce_ex__ in the _io module (GH-117773)

__reduce__() does not have parameters, __reduce_ex__() has a single
parameter.

18 months agogh-117764: Add signatures for some functions in the sys module (GH-117770)
Serhiy Storchaka [Fri, 12 Apr 2024 09:12:48 +0000 (12:12 +0300)] 
gh-117764: Add signatures for some functions in the sys module (GH-117770)

Use Argument Clinic if possible.

18 months agogh-117764: Add docstrings and signatures for the __replace__ methods (GH-117768)
Serhiy Storchaka [Fri, 12 Apr 2024 08:46:20 +0000 (11:46 +0300)] 
gh-117764: Add docstrings and signatures for the __replace__ methods (GH-117768)

18 months agogh-117431: Adapt bytes and bytearray .find() and friends to Argument Clinic (#117502)
Erlend E. Aasland [Fri, 12 Apr 2024 07:40:55 +0000 (09:40 +0200)] 
gh-117431: Adapt bytes and bytearray .find() and friends to Argument Clinic (#117502)

This change gives a significant speedup, as the METH_FASTCALL calling
convention is now used. The following bytes and bytearray methods are adapted:

- count()
- find()
- index()
- rfind()
- rindex()

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
18 months agogh-117752: Autoconf: fix -fno-semantic-interposition check (#117789)
Erlend E. Aasland [Fri, 12 Apr 2024 07:37:38 +0000 (09:37 +0200)] 
gh-117752: Autoconf: fix -fno-semantic-interposition check (#117789)

Force the compiler to issue an error if the flag is not supported.

18 months agogh-117752: Autoconf: store all LLVM profile data in the build directory (#117790)
Erlend E. Aasland [Fri, 12 Apr 2024 05:23:39 +0000 (07:23 +0200)] 
gh-117752: Autoconf: store all LLVM profile data in the build directory (#117790)

This prevents spurious 'env changed' and llvm-profdata merge errors.

18 months agogh-76785: Handle Legacy Interpreters Properly (gh-117490)
Eric Snow [Thu, 11 Apr 2024 23:23:25 +0000 (17:23 -0600)] 
gh-76785: Handle Legacy Interpreters Properly (gh-117490)

This is similar to the situation with threading._DummyThread.  The methods (incl. __del__()) of interpreters.Interpreter objects must be careful with interpreters not created by interpreters.create().  The simplest thing to start with is to disable any method that modifies or runs in the interpreter.  As part of this, the runtime keeps track of where an interpreter was created.  We also handle interpreter "refcounts" properly.

18 months agogh-117787: Autoconf: fix bashisms/semantic breakage of iOS checks (#117788)
Eli Schwartz [Thu, 11 Apr 2024 23:03:54 +0000 (19:03 -0400)] 
gh-117787: Autoconf: fix bashisms/semantic breakage of iOS checks (#117788)

18 months agogh-116738: Make _abc module thread-safe (#117488)
Brett Simmers [Thu, 11 Apr 2024 22:13:25 +0000 (15:13 -0700)] 
gh-116738: Make _abc module thread-safe (#117488)

A collection of small changes aimed at making the `_abc` module safe to
use in a free-threaded build.

18 months agogh-117649: Fix file descriptor leak in (expected) failing test case (#117780)
Sam Gross [Thu, 11 Apr 2024 21:35:46 +0000 (17:35 -0400)] 
gh-117649: Fix file descriptor leak in (expected) failing test case (#117780)

The test case is currently expected to fail in the free-threaded build.
However, it fails before it gets a chance to close the write end of
the pipe.

18 months agogh-117649: Raise ImportError for unsupported modules in free-threaded build (#117651)
Sam Gross [Thu, 11 Apr 2024 19:00:54 +0000 (15:00 -0400)] 
gh-117649: Raise ImportError for unsupported modules in free-threaded build (#117651)

The free-threaded build does not currently support the combination of
single-phase init modules and non-isolated subinterpreters. Ensure that
`check_multi_interp_extensions` is always `True` for subinterpreters in
the free-threaded build so that importing these modules raises an
`ImportError`.

18 months agogh-111506: Error if the limited API is used in free-threaded build (#117762)
Sam Gross [Thu, 11 Apr 2024 17:49:52 +0000 (13:49 -0400)] 
gh-111506: Error if the limited API is used in free-threaded build (#117762)

Issue a build time error if both `Py_LIMITED_API` and `Py_GIL_DISABLED`
are defined.

18 months agogh-104269: Document `glob.glob` duplicates when using multiple `**` patterns (#105406)
Tomas R [Thu, 11 Apr 2024 15:16:39 +0000 (17:16 +0200)] 
gh-104269: Document `glob.glob` duplicates when using multiple `**` patterns (#105406)