]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
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)

18 months agogh-117233: Detect support for several hashes at hashlib build time (GH-117234)
Will Childs-Klein [Thu, 11 Apr 2024 14:49:41 +0000 (10:49 -0400)] 
gh-117233: Detect support for several hashes at hashlib build time (GH-117234)

Detect libcrypto BLAKE2, Shake, SHA3, and Truncated-SHA512 support at hashlib build time

## BLAKE2

While OpenSSL supports both "b" and "s" variants of the BLAKE2 hash
function, other cryptographic libraries may lack support for one or both
of the variants. This commit modifies `hashlib`'s C code to detect
whether or not the linked libcrypto supports each BLAKE2 variant, and
elides references to each variant's NID accordingly. In cases where the
underlying libcrypto doesn't fully support BLAKE2, CPython's
`./configure` script can be given the following flag to use CPython's
interned BLAKE2 implementation: `--with-builtin-hashlib-hashes=blake2`.

## SHA3, Shake, & truncated SHA512.

Detect BLAKE2, SHA3, Shake, & truncated SHA512 support in the
OpenSSL-ish libcrypto library at build time.  This helps allow hashlib's
`_hashopenssl` to be used with libraries that do not to support every
algorithm that upstream OpenSSL does.  Such as AWS-LC & BoringSSL.

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
18 months agogh-117722: Fix Stream.readuntil with non-bytes buffer objects (#117723)
Bruce Merry [Thu, 11 Apr 2024 14:41:55 +0000 (16:41 +0200)] 
gh-117722: Fix Stream.readuntil with non-bytes buffer objects (#117723)

gh-16429 introduced support for an iterable of separators in
Stream.readuntil. Since bytes-like types are themselves iterable, this
can introduce ambiguities in deciding whether the argument is an
iterator of separators or a singleton separator. In gh-16429, only 'bytes'
was considered a singleton, but this will break code that passes other
buffer object types.

Fix it by only supporting tuples rather than arbitrary iterables.

Closes gh-117722.

18 months agogh-101549: fix documentation of xml.etree.ElementInclude (#101550)
Mikhail B [Thu, 11 Apr 2024 14:23:52 +0000 (10:23 -0400)] 
gh-101549: fix documentation of xml.etree.ElementInclude (#101550)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
18 months agogh-115142: Skip ``test_capi/test_opt.py`` if ``_testinternalcapi`` is not available...
Kirill Podoprigora [Thu, 11 Apr 2024 14:19:19 +0000 (17:19 +0300)] 
gh-115142: Skip ``test_capi/test_opt.py`` if ``_testinternalcapi`` is not available (GH-117574)

18 months agoFix markup of `win32_ver` in `platform.rst` (#116492)
Nikita Sobolev [Thu, 11 Apr 2024 14:13:53 +0000 (17:13 +0300)] 
Fix markup of `win32_ver` in `platform.rst` (#116492)

18 months agogh-117709: Add vectorcall support for str() with positional-only arguments (#117746)
Erlend E. Aasland [Thu, 11 Apr 2024 13:55:37 +0000 (15:55 +0200)] 
gh-117709: Add vectorcall support for str() with positional-only arguments (#117746)

Fall back to tp_call() for cases when arguments are passed by name.

Co-authored-by: Donghee Na <donghee.na@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
18 months agogh-113317: Add ParseArgsCodeGen class (#117707)
Victor Stinner [Thu, 11 Apr 2024 13:49:07 +0000 (15:49 +0200)] 
gh-113317: Add ParseArgsCodeGen class (#117707)

18 months agogh-113317: Add Codegen class to Argument Clinic (#117626)
Victor Stinner [Thu, 11 Apr 2024 10:15:48 +0000 (12:15 +0200)] 
gh-113317: Add Codegen class to Argument Clinic (#117626)

* Move ifndef_symbols, includes and add_include() from Clinic to
  Codegen. Add a 'codegen' (Codegen) attribute to Clinic.
* Remove libclinic.crenderdata module: move code to libclinic.codegen.
* BlockPrinter.print_block(): remove unused 'limited_capi' argument.
  Remove also 'core_includes' parameter.
* Add get_includes() methods.
* Make Codegen.ifndef_symbols private.
* Make Codegen.includes private.
* Make CConverter.includes private.

18 months agogh-117711: Only check for 'test/wheeldata' when it's actually used (#117712)
Karolina Surma [Thu, 11 Apr 2024 09:37:28 +0000 (11:37 +0200)] 
gh-117711: Only check for 'test/wheeldata' when it's actually used (#117712)

It's possible to build Python with option `--with-wheel-pkg-dir`
pointing to a custom wheel directory. Don't include the directory in the test
set if the wheels are used from a different location.

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
19 months agogh-117606: Truncate extremely long error message in `test_exceptions` (#117670)
Nice Zombies [Thu, 11 Apr 2024 07:37:01 +0000 (09:37 +0200)] 
gh-117606: Truncate extremely long error message in `test_exceptions` (#117670)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
19 months agogh-76785: Add More Tests to test_interpreters.test_api (gh-117662)
Eric Snow [Thu, 11 Apr 2024 00:37:01 +0000 (18:37 -0600)] 
gh-76785: Add More Tests to test_interpreters.test_api (gh-117662)

In addition to the increase test coverage, this is a precursor to sorting out how we handle interpreters created directly via the C-API.

19 months agoGH-117586: Speed up `pathlib.Path.walk()` by working with strings (#117726)
Barney Gale [Thu, 11 Apr 2024 00:26:53 +0000 (01:26 +0100)] 
GH-117586: Speed up `pathlib.Path.walk()` by working with strings (#117726)

Move `pathlib.Path.walk()` implementation into `glob._Globber`. The new
`glob._Globber.walk()` classmethod works with strings internally, which is
a little faster than generating `Path` objects and keeping them normalized.
The `pathlib.Path.walk()` method converts the strings back to path objects.

In the private pathlib ABCs, our existing subclass of `_Globber` ensures
that `PathBase` instances are used throughout.

Follow-up to #117589.

19 months agoGH-117586: Speed up `pathlib.Path.glob()` by working with strings (#117589)
Barney Gale [Wed, 10 Apr 2024 19:43:07 +0000 (20:43 +0100)] 
GH-117586: Speed up `pathlib.Path.glob()` by working with strings (#117589)

Move pathlib globbing implementation into a new private class: `glob._Globber`. This class implements fast string-based globbing. It's called by `pathlib.Path.glob()`, which then converts strings back to path objects.

In the private pathlib ABCs, add a `pathlib._abc.Globber` subclass that works with `PathBase` objects rather than strings, and calls user-defined path methods like `PathBase.stat()` rather than `os.stat()`.

This sets the stage for two more improvements:

- GH-115060: Query non-wildcard segments with `lstat()`
- GH-116380: Unify `pathlib` and `glob` implementations of globbing.

No change to the implementations of `glob.glob()` and `glob.iglob()`.

19 months agogh-67224: Make linecache imports relative to improve startup speed (#117501)
Pablo Galindo Salgado [Wed, 10 Apr 2024 19:09:25 +0000 (20:09 +0100)] 
gh-67224: Make linecache imports relative to improve startup speed (#117501)

19 months agoGH-117546: Fix symlink resolution in `os.path.realpath('loop/../link')` (#117568)
Barney Gale [Wed, 10 Apr 2024 17:17:18 +0000 (18:17 +0100)] 
GH-117546: Fix symlink resolution in `os.path.realpath('loop/../link')` (#117568)

Continue resolving symlink targets after encountering a symlink loop, which
matches coreutils `realpath` behaviour.

19 months agogh-117531: Unblock getters after non-immediate queue shutdown (#117532)
Laurie O [Wed, 10 Apr 2024 15:01:42 +0000 (01:01 +1000)] 
gh-117531: Unblock getters after non-immediate queue shutdown (#117532)

(This is a small tweak of the original gh-104750 which added shutdown.)

19 months agogh-115142: Skip ``test_capi.test_dict.py`` if ``_testcapi`` and ``_testlimitedcapi...
Kirill Podoprigora [Wed, 10 Apr 2024 14:32:57 +0000 (17:32 +0300)] 
gh-115142: Skip ``test_capi.test_dict.py`` if ``_testcapi`` and ``_testlimitedcapi`` are not available (GH-117588)

gh-115142: Skip test_dict if _testcapi and _testlimitedcapi is not available

19 months agogh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is enabled (#117702)
Sam Gross [Wed, 10 Apr 2024 14:20:05 +0000 (10:20 -0400)] 
gh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is enabled (#117702)

The `__has_feature(thread_sanitizer)` is a Clang-ism. Although new
versions of GCC implement `__has_feature`, the `defined(__has_feature)`
check still fails on GCC so we don't use that code path.

19 months agogh-117142: Port _ctypes to multi-phase init (GH-117181)
neonene [Wed, 10 Apr 2024 11:00:01 +0000 (20:00 +0900)] 
gh-117142: Port _ctypes to multi-phase init (GH-117181)

19 months agogh-117692: Fix `AttributeError` in `DocTestFinder` on wrapped `builtin_or_method...
Nikita Sobolev [Wed, 10 Apr 2024 09:52:47 +0000 (12:52 +0300)] 
gh-117692: Fix `AttributeError` in `DocTestFinder` on wrapped `builtin_or_method` (#117699)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
19 months agogh-117686: Improve the performance of ntpath.expanduser() (#117690)
Nice Zombies [Wed, 10 Apr 2024 08:28:48 +0000 (10:28 +0200)] 
gh-117686: Improve the performance of ntpath.expanduser() (#117690)

Refactor out _get_bothseps() call from the loop.

19 months agogh-117431: Argument Clinic: copy forced text signature when cloning (#117591)
Erlend E. Aasland [Wed, 10 Apr 2024 08:12:05 +0000 (10:12 +0200)] 
gh-117431: Argument Clinic: copy forced text signature when cloning (#117591)

19 months agogh-117360: Clearer wording in os.path.lexists() docs (#117679)
Nice Zombies [Tue, 9 Apr 2024 21:00:41 +0000 (23:00 +0200)] 
gh-117360: Clearer wording in os.path.lexists() docs (#117679)

Co-authored-by: Zachary Ware <zach@python.org>
19 months agogh-117597: Clarify exception handling in the tutorial (#117681)
Nice Zombies [Tue, 9 Apr 2024 20:59:45 +0000 (22:59 +0200)] 
gh-117597: Clarify exception handling in the tutorial (#117681)

19 months agogh-117648: Amend NEWS entry (#117697)
Erlend E. Aasland [Tue, 9 Apr 2024 20:03:47 +0000 (22:03 +0200)] 
gh-117648: Amend NEWS entry (#117697)

Make the wording more vague; the performance impact varies a lot
depending on platform and input.

19 months agoMerge branch 'main' of https://github.com/python/cpython
Thomas Wouters [Tue, 9 Apr 2024 18:42:07 +0000 (20:42 +0200)] 
Merge branch 'main' of https://github.com/python/cpython

19 months agoPost 3.13.0a6
Thomas Wouters [Tue, 9 Apr 2024 18:40:50 +0000 (20:40 +0200)] 
Post 3.13.0a6

19 months agogh-117663: [Enum] fix _simple_enum's detection of aliases (GH-117664)
Ethan Furman [Tue, 9 Apr 2024 18:31:07 +0000 (11:31 -0700)] 
gh-117663: [Enum] fix _simple_enum's detection of aliases (GH-117664)

19 months agogh-117534: Add checking for input parameter in iso_to_ymd (#117543)
Vlad4896 [Tue, 9 Apr 2024 17:53:00 +0000 (20:53 +0300)] 
gh-117534: Add checking for input parameter in iso_to_ymd (#117543)

Moves the validation for invalid years in the C implementation of the `datetime` module into a common location between `fromisoformat` and `fromisocalendar`, which improves the error message and fixes a failed assertion when parsing invalid ISO 8601 years using one of the "ISO weeks" formats.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
19 months agoRevert "gh-106023: Update What's New in 3.13: _PyObject_FastCall() (#117633)" (#117676)
Victor Stinner [Tue, 9 Apr 2024 16:26:35 +0000 (18:26 +0200)] 
Revert "gh-106023: Update What's New in 3.13: _PyObject_FastCall() (#117633)" (#117676)

This reverts commit 9a12f5d1c19dee1f89684be776680aeaf117be5b.

I was wrong: the _PyObject_FastCall() function was removed. But we
kept the _PyObject_FastCallDict() function.

19 months agogh-117658: Fix check_dump_traceback_threads in free-threaded build (#117659)
Sam Gross [Tue, 9 Apr 2024 15:50:49 +0000 (11:50 -0400)] 
gh-117658: Fix check_dump_traceback_threads in free-threaded build (#117659)

With the GIL disabled, the waiting thread may still be in the
`self.running.set() ` call when faulthandler dumps tracebacks.

19 months agogh-116720: Fix corner cases of taskgroups (#117407)
Guido van Rossum [Tue, 9 Apr 2024 15:17:28 +0000 (08:17 -0700)] 
gh-116720: Fix corner cases of taskgroups (#117407)

This prevents external cancellations of a task group's parent task to
be dropped when an internal cancellation happens at the same time.
Also strengthen the semantics of uncancel() to clear self._must_cancel
when the cancellation count reaches zero.

Co-Authored-By: Tin Tvrtković <tinchester@gmail.com>
Co-Authored-By: Arthur Tacca
19 months agogh-116622: Enable `test_doctest` on platforms that don't support subprocesses (#116758)
Malcolm Smith [Tue, 9 Apr 2024 11:40:58 +0000 (12:40 +0100)] 
gh-116622: Enable `test_doctest` on platforms that don't support subprocesses (#116758)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
19 months agogh-117516: Implement typing.TypeIs (#117517)
Jelle Zijlstra [Tue, 9 Apr 2024 10:50:37 +0000 (06:50 -0400)] 
gh-117516: Implement typing.TypeIs (#117517)

See PEP 742.

Co-authored-by: Carl Meyer <carl@oddbird.net>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
19 months agoPython 3.13.0a6 v3.13.0a6
Thomas Wouters [Tue, 9 Apr 2024 09:52:31 +0000 (11:52 +0200)] 
Python 3.13.0a6

19 months agogh-107674: Remove some unnecessary code in instrumentation code (GH-117393)
Tian Gao [Tue, 9 Apr 2024 08:54:28 +0000 (01:54 -0700)] 
gh-107674: Remove some unnecessary code in instrumentation code (GH-117393)

19 months agogh-117648: Improve performance of os.join (#117654)
Nice Zombies [Tue, 9 Apr 2024 08:27:14 +0000 (10:27 +0200)] 
gh-117648: Improve performance of os.join (#117654)

Replace map() with a method call in the loop body.

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
19 months agogh-117182: Allow lazily loaded modules to modify their own __class__
Chris Markiewicz [Tue, 9 Apr 2024 03:08:48 +0000 (23:08 -0400)] 
gh-117182: Allow lazily loaded modules to modify their own __class__

19 months agogh-117645: Skip test_dynamic global specialization on WASI (#117646)
Victor Stinner [Mon, 8 Apr 2024 19:11:08 +0000 (21:11 +0200)] 
gh-117645: Skip test_dynamic global specialization on WASI (#117646)

Skip test_load_global_specialization_failure_keeps_oparg() of
test_dynamic on WASI build. The test uses too much stack memory.

19 months agoEnhance regrtest get_signal_name(): support shell exit code (#117647)
Victor Stinner [Mon, 8 Apr 2024 17:16:43 +0000 (19:16 +0200)] 
Enhance regrtest get_signal_name(): support shell exit code (#117647)

19 months agogh-81322: support multiple separators in StreamReader.readuntil (#16429)
Bruce Merry [Mon, 8 Apr 2024 16:58:02 +0000 (18:58 +0200)] 
gh-81322: support multiple separators in StreamReader.readuntil (#16429)

19 months agogh-117642: Fix PEP 737 implementation (GH-117643)
Serhiy Storchaka [Mon, 8 Apr 2024 16:27:25 +0000 (19:27 +0300)] 
gh-117642: Fix PEP 737 implementation (GH-117643)

* Fix implementation of %#T and %#N (they were implemented as %T# and
  %N#).
* Restore tests removed in gh-116417.

19 months agogh-117439: Make refleak checking thread-safe without the GIL (#117469)
Sam Gross [Mon, 8 Apr 2024 16:11:36 +0000 (12:11 -0400)] 
gh-117439: Make refleak checking thread-safe without the GIL (#117469)

This keeps track of the per-thread total reference count operations in
PyThreadState in the free-threaded builds. The count is merged into the
interpreter's total when the thread exits.

19 months agogh-117547: Fix mimalloc compile error on OpenBSD (#117548)
Sam Gross [Mon, 8 Apr 2024 15:53:13 +0000 (11:53 -0400)] 
gh-117547: Fix mimalloc compile error on OpenBSD (#117548)