]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
21 months agoGH-79634: Accept path-like objects as pathlib glob patterns. (#114017)
Barney Gale [Sat, 20 Jan 2024 02:10:25 +0000 (02:10 +0000)] 
GH-79634: Accept path-like objects as pathlib glob patterns. (#114017)

Allow `os.PathLike` objects to be passed as patterns to `pathlib.Path.glob()` and `rglob()`. (It's already possible to use them in `PurePath.match()`)

While we're in the area:

- Allow empty glob patterns in `PathBase` (but not `Path`)
- Speed up globbing in `PathBase` by generating paths with trailing slashes only as a final step, rather than for every intermediate directory.
- Simplify and speed up handling of rare patterns involving both `**` and `..` segments.

21 months agoAdd a `clean` subcommand to `Tools/wasm/wasi.py` (GH-114274)
Brett Cannon [Fri, 19 Jan 2024 19:38:52 +0000 (11:38 -0800)] 
Add a `clean` subcommand to `Tools/wasm/wasi.py` (GH-114274)

21 months agoRetain shorter tables of contents for Sphinx 5.2.3+ (#114318)
Hugo van Kemenade [Fri, 19 Jan 2024 18:52:42 +0000 (20:52 +0200)] 
Retain shorter tables of contents for Sphinx 5.2.3+ (#114318)

Disable toc_object_entries, new in Sphinx 5.2.3

21 months agogh-114265: move line number propagation before cfg optimization, remove guarantee_lin...
Irit Katriel [Fri, 19 Jan 2024 14:49:26 +0000 (14:49 +0000)] 
gh-114265: move line number propagation before cfg optimization, remove guarantee_lineno_for_exits (#114267)

21 months agogh-114275: Skip doctests that use `asyncio` in `test_pdb` for WASI builds (#114309)
Nikita Sobolev [Fri, 19 Jan 2024 13:00:34 +0000 (16:00 +0300)] 
gh-114275: Skip doctests that use `asyncio` in `test_pdb` for WASI builds (#114309)

21 months agogh-113884: Refactor `queue.SimpleQueue` to use a ring buffer to store items (#114259)
mpage [Fri, 19 Jan 2024 12:17:51 +0000 (04:17 -0800)] 
gh-113884: Refactor `queue.SimpleQueue` to use a ring buffer to store items (#114259)

Use a ring buffer instead of a Python list in order to simplify the
process of making queue.SimpleQueue thread-safe in free-threaded
builds. The ring buffer implementation has no places where critical
sections may be released.

21 months agogh-114286: Fix `maybe-uninitialized` warning in `Modules/_io/fileio.c` (GH-114287)
Nikita Sobolev [Fri, 19 Jan 2024 10:25:05 +0000 (13:25 +0300)] 
gh-114286: Fix `maybe-uninitialized` warning in `Modules/_io/fileio.c` (GH-114287)

21 months agogh-111968: Fix --without-freelists build (gh-114270)
Donghee Na [Thu, 18 Jan 2024 23:25:13 +0000 (08:25 +0900)] 
gh-111968: Fix --without-freelists build (gh-114270)

21 months agogh-112087: Remove duplicated critical_section (gh-114268)
Donghee Na [Thu, 18 Jan 2024 23:03:28 +0000 (08:03 +0900)] 
gh-112087: Remove duplicated critical_section (gh-114268)

21 months agogh-114123: Migrate docstring from _csv to csv (#114124)
Skip Montanaro [Thu, 18 Jan 2024 22:18:42 +0000 (16:18 -0600)] 
gh-114123: Migrate docstring from _csv to csv (#114124)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
21 months agogh-112092: clarify unstable ABI recompilation requirements (#112093)
DerSchinken [Thu, 18 Jan 2024 20:04:40 +0000 (21:04 +0100)] 
gh-112092: clarify unstable ABI recompilation requirements (#112093)

Use different versions in the examples for when extensions do and do not need to be recompiled to make the examples easier to understand.

21 months agogh-111968: Use per-thread freelists for generator in free-threading (gh-114189)
Donghee Na [Thu, 18 Jan 2024 18:15:00 +0000 (03:15 +0900)] 
gh-111968: Use per-thread freelists for generator in free-threading (gh-114189)

21 months agogh-114087: Speed up dataclasses._asdict_inner (#114088)
keithasaurus [Thu, 18 Jan 2024 16:03:20 +0000 (08:03 -0800)] 
gh-114087: Speed up dataclasses._asdict_inner (#114088)

21 months agogh-114198: Rename dataclass __replace__ argument to 'self' (gh-114251)
Phillip Schanely [Thu, 18 Jan 2024 16:01:17 +0000 (11:01 -0500)] 
gh-114198: Rename dataclass __replace__ argument to 'self' (gh-114251)

This change renames the dataclass __replace__ method's first argument
name from 'obj' to 'self'.

21 months agogh-108303: Move all doctest related files and tests to `Lib/test/test_doctest/` ...
Nikita Sobolev [Thu, 18 Jan 2024 15:58:11 +0000 (18:58 +0300)] 
gh-108303: Move all doctest related files and tests to `Lib/test/test_doctest/` (#112109)

Co-authored-by: Brett Cannon <brett@python.org>
21 months agoDelete unused macro (GH-114238)
Mark Shannon [Thu, 18 Jan 2024 15:49:50 +0000 (15:49 +0000)] 
Delete unused macro (GH-114238)

21 months agogh-110345: show Tcl/Tk patchlevel in `tkinter._test()` (GH-110350)
Christopher Chavez [Thu, 18 Jan 2024 15:46:58 +0000 (09:46 -0600)] 
gh-110345: show Tcl/Tk patchlevel in `tkinter._test()` (GH-110350)

21 months agogh-103092: Convert some `_ctypes` metatypes to heap types (GH-113620)
AN Long [Thu, 18 Jan 2024 15:30:27 +0000 (23:30 +0800)] 
gh-103092: Convert some `_ctypes` metatypes to heap types (GH-113620)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
21 months agogh-114050: Fix crash when more than two arguments are passed to int() (GH-114067)
kcatss [Thu, 18 Jan 2024 11:27:44 +0000 (20:27 +0900)] 
gh-114050: Fix crash when more than two arguments are passed to int() (GH-114067)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
21 months agogh-104522: Fix test_subprocess failure when build Python in the root home directory...
Serhiy Storchaka [Thu, 18 Jan 2024 10:52:59 +0000 (12:52 +0200)] 
gh-104522: Fix test_subprocess failure when build Python in the root home directory (GH-114236)

* gh-104522: Fix test_subprocess failure when build Python in the root home directory

EPERM is raised when setreuid() fails.
EACCES is set in execve() when the test user has not access to sys.executable.

21 months agogh-114231: Fix indentation in enum.rst (#114232)
Miyashita Yosuke [Thu, 18 Jan 2024 09:23:15 +0000 (18:23 +0900)] 
gh-114231: Fix indentation in enum.rst (#114232)

21 months agogh-96905: In IDLE code, stop redefining built-ins 'dict' and 'object' (#114227)
Terry Jan Reedy [Thu, 18 Jan 2024 04:39:12 +0000 (23:39 -0500)] 
gh-96905: In IDLE code, stop redefining built-ins 'dict' and 'object' (#114227)

Prefix 'dict' with 'o', 'g', or 'l' for 'object', 'global', or 'local'.
Suffix 'object' with '_'.

21 months agogh-114211: Update EmailMessage doc about ordered keys (#114224)
Terry Jan Reedy [Thu, 18 Jan 2024 02:25:22 +0000 (21:25 -0500)] 
gh-114211: Update EmailMessage doc about ordered keys (#114224)

Ordered keys are no longer unlike 'real dict's.

21 months agogh-113205: test_multiprocessing.test_terminate: Test the API on threadpools (#114186)
Petr Viktorin [Thu, 18 Jan 2024 01:15:29 +0000 (02:15 +0100)] 
gh-113205: test_multiprocessing.test_terminate: Test the API on threadpools (#114186)

gh-113205: test_multiprocessing.test_terminate: Test the API works on threadpools

Threads can't be forced to terminate (without potentially corrupting too much
state), so the  expected behaviour of `ThreadPool.terminate` is to wait for
the currently executing tasks to finish.

The entire test was skipped in GH-110848 (0e9c364f4ac18a2237bdbac702b96bcf8ef9cb09).
Instead of skipping it entirely, we should ensure the API eventually succeeds:
use a shorter timeout.

For the record: on my machine, when the test is un-skipped, the task manages to
start in about 1.5% cases.

21 months agogh-104522: Fix OSError raised when run a subprocess (#114195)
Serhiy Storchaka [Thu, 18 Jan 2024 00:52:42 +0000 (02:52 +0200)] 
gh-104522: Fix OSError raised when run a subprocess (#114195)

Only set filename to cwd if it was caused by failed chdir(cwd).

_fork_exec() now returns "noexec:chdir" for failed chdir(cwd).

Co-authored-by: Robert O'Shea <PurityLake@users.noreply.github.com>
21 months agogh-114149: [Enum] revert #114160 and add more tuple-subclass tests (GH-114215)
Ethan Furman [Thu, 18 Jan 2024 00:31:00 +0000 (16:31 -0800)] 
gh-114149: [Enum] revert #114160 and add more tuple-subclass tests (GH-114215)

This reverts commit 05e142b1543eb9662d6cc33722e7e16250c9219f.

21 months agogh-112984: Fix test_ctypes.test_loading.test_load_dll_with_flags when directory name...
Steve Dower [Thu, 18 Jan 2024 00:26:31 +0000 (00:26 +0000)] 
gh-112984: Fix test_ctypes.test_loading.test_load_dll_with_flags when directory name includes a dot (GH-114217)

21 months agogh-112984 Update Windows build and installer for free-threaded builds (GH-113129)
Steve Dower [Wed, 17 Jan 2024 21:52:23 +0000 (21:52 +0000)] 
gh-112984 Update Windows build and installer for free-threaded builds (GH-113129)

21 months agogh-38807: Fix race condition in Lib/trace.py (GH-110143)
buermarc [Wed, 17 Jan 2024 20:02:14 +0000 (21:02 +0100)] 
gh-38807: Fix race condition in Lib/trace.py (GH-110143)

Instead of checking if a directory does not exist and thereafter
creating it, directly call os.makedirs() with the exist_ok=True.

21 months agoFix typo in tkinter.ttk.rst (GH-106157)
Christophe Nanteuil [Wed, 17 Jan 2024 18:23:25 +0000 (19:23 +0100)] 
Fix typo in tkinter.ttk.rst (GH-106157)

21 months agogh-105102: Fix nested unions in structures when the system byteorder is the opposite...
Sheidan [Wed, 17 Jan 2024 18:20:39 +0000 (19:20 +0100)] 
gh-105102: Fix nested unions in structures when the system byteorder is the opposite (GH-105106)

21 months agogh-114149: [Enum] fix tuple subclass handling when using custom __new__ (GH-114160)
Ethan Furman [Wed, 17 Jan 2024 17:47:11 +0000 (09:47 -0800)] 
gh-114149: [Enum] fix tuple subclass handling when using custom __new__ (GH-114160)

21 months agogh-114070: fix token reference warnings in expressions.rst (#114169)
Sergey B Kirpichev [Wed, 17 Jan 2024 16:39:50 +0000 (19:39 +0300)] 
gh-114070: fix token reference warnings in expressions.rst (#114169)

21 months agogh-114178: Fix generate_sbom.py for out-of-tree builds (#114179)
Erlend E. Aasland [Wed, 17 Jan 2024 16:25:39 +0000 (17:25 +0100)] 
gh-114178: Fix generate_sbom.py for out-of-tree builds (#114179)

21 months agoMerge branch 'main' of https://github.com/python/cpython
Thomas Wouters [Wed, 17 Jan 2024 15:19:08 +0000 (16:19 +0100)] 
Merge branch 'main' of https://github.com/python/cpython

21 months agoPost 3.13.0a3
Thomas Wouters [Wed, 17 Jan 2024 15:17:42 +0000 (16:17 +0100)] 
Post 3.13.0a3

21 months agogh-112343: pdb: Use tokenize to replace convenience variables (#112380)
Tian Gao [Wed, 17 Jan 2024 14:50:31 +0000 (06:50 -0800)] 
gh-112343: pdb: Use tokenize to replace convenience variables (#112380)

21 months agogh-111301: Advertise importlib methods removal in What's new in Python 3.12 (GH-111630)
Karolina Surma [Wed, 17 Jan 2024 14:25:42 +0000 (15:25 +0100)] 
gh-111301: Advertise importlib methods removal in What's new in Python 3.12 (GH-111630)

21 months agogh-104282: Fix null pointer dereference in `lzma._decode_filter_properties` (GH-104283)
Radislav Chugunov [Wed, 17 Jan 2024 13:15:44 +0000 (16:15 +0300)] 
gh-104282: Fix null pointer dereference in `lzma._decode_filter_properties` (GH-104283)

21 months agoPython 3.13.0a3 v3.13.0a3
Thomas Wouters [Wed, 17 Jan 2024 12:09:05 +0000 (13:09 +0100)] 
Python 3.13.0a3

21 months agogh-86179: Skip test case that fails on POSIX with unversioned binary (GH-114136)
Steve Dower [Wed, 17 Jan 2024 11:33:59 +0000 (11:33 +0000)] 
gh-86179: Skip test case that fails on POSIX with unversioned binary (GH-114136)

21 months agogh-72284: Revise lists in IDLE doc (#114174)
Terry Jan Reedy [Wed, 17 Jan 2024 07:52:32 +0000 (02:52 -0500)] 
gh-72284: Revise lists in IDLE doc  (#114174)

Tkinter is a fact, not necessarily a feature.

Reorganize editor key bindings in a logical order
and remove those that do not work, at least on Windows.

Improve shell bindings list.

21 months agogh-81479: For Help => IDLE Doc, stop double-spacing some lists. (#114168)
Terry Jan Reedy [Wed, 17 Jan 2024 05:24:59 +0000 (00:24 -0500)] 
gh-81479: For Help => IDLE Doc, stop double-spacing some lists. (#114168)

This matches Firefox format.  Edge double-spaces non-simple
list but I think it looks worse.

21 months agogh-112043: Align concurrent.futures.Executor.map docs with implementation (#114153)
Erlend E. Aasland [Wed, 17 Jan 2024 01:31:16 +0000 (02:31 +0100)] 
gh-112043: Align concurrent.futures.Executor.map docs with implementation (#114153)

The first parameter is named 'fn', not 'func'.

21 months agogh-88531 Fix dataclass __post_init__/__init__ interplay documentation (gh-107404)
Steffen Zeile [Wed, 17 Jan 2024 01:17:34 +0000 (02:17 +0100)] 
gh-88531 Fix dataclass __post_init__/__init__ interplay documentation (gh-107404)

* Simplify __post_init__ example usage. It applies to all base classes, not just dataclasses.

21 months agogh-106293: Fix typos in Objects/object_layout.md (#106294)
Mano Sriram [Tue, 16 Jan 2024 23:11:15 +0000 (04:41 +0530)] 
gh-106293: Fix typos in Objects/object_layout.md (#106294)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
21 months agoGH-110109: pathlib docs: bring `from_uri()` and `as_uri()` together. (#110312)
Barney Gale [Tue, 16 Jan 2024 22:51:57 +0000 (22:51 +0000)] 
GH-110109: pathlib docs: bring `from_uri()` and `as_uri()` together. (#110312)

This is a very soft deprecation of `PurePath.as_uri()`. We instead document
it as a `Path` method, and add a couple of sentences mentioning that it's
also available in `PurePath`.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
21 months agoFix typo in c_annotations.py comment (#108773)
Kuan-Wei Chiu [Tue, 16 Jan 2024 22:36:01 +0000 (06:36 +0800)] 
Fix typo in c_annotations.py comment (#108773)

"compatability" => "compatibility"

21 months agogh-94220: Align fnmatch docs with the implementation and amend markup (#114152)
Erlend E. Aasland [Tue, 16 Jan 2024 22:35:09 +0000 (23:35 +0100)] 
gh-94220: Align fnmatch docs with the implementation and amend markup (#114152)

- Align the argument spec for fnmatch functions with the actual
  implementation.
- Update Sphinx markup to recent recommandations.
- Add link to 'iterable' glossary entry.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
21 months agoGH-78988: Document `pathlib.Path.glob()` exception propagation. (#114036)
Barney Gale [Tue, 16 Jan 2024 22:28:54 +0000 (22:28 +0000)] 
GH-78988: Document `pathlib.Path.glob()` exception propagation. (#114036)

We propagate the `OSError` from the `is_dir()` call on the top-level
directory, and suppress all others.

21 months agogh-113655: Increase default stack size for PGO builds to avoid C stack exhaustion...
Steve Dower [Tue, 16 Jan 2024 22:02:20 +0000 (22:02 +0000)] 
gh-113655: Increase default stack size for PGO builds to avoid C stack exhaustion (GH-114148)

21 months agogh-112529: Track if debug allocator is used as underlying allocator (#113747)
Sam Gross [Tue, 16 Jan 2024 21:42:15 +0000 (16:42 -0500)] 
gh-112529: Track if debug allocator is used as underlying allocator (#113747)

* gh-112529: Track if debug allocator is used as underlying allocator

The GC implementation for free-threaded builds will need to accurately
detect if the debug allocator is used because it affects the offset of
the Python object from the beginning of the memory allocation. The
current implementation of `_PyMem_DebugEnabled` only considers if the
debug allocator is the outer-most allocator; it doesn't handle the case
of "hooks" like tracemalloc being used on top of the debug allocator.

This change enables more accurate detection of the debug allocator by
tracking when debug hooks are enabled.

* Simplify _PyMem_DebugEnabled

21 months agoUpdate copyright years to 2024. (GH-113608)
solya0x [Tue, 16 Jan 2024 20:54:05 +0000 (23:54 +0300)] 
Update copyright years to 2024. (GH-113608)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
21 months agoGH-114013: fix setting `HOSTRUNNER` for `Tools/wasm/wasi.py` (GH-114097)
Brett Cannon [Tue, 16 Jan 2024 19:36:41 +0000 (11:36 -0800)] 
GH-114013: fix setting `HOSTRUNNER` for `Tools/wasm/wasi.py` (GH-114097)

Also fix tests found failing under a pydebug build of WASI thanks to `make test` working due to this change.

21 months agoClean up backslash avoiding code in ast, fix typo (#113605)
Shantanu [Tue, 16 Jan 2024 19:24:25 +0000 (11:24 -0800)] 
Clean up backslash avoiding code in ast, fix typo (#113605)

As of #108553, the `_avoid_backslashes` code path is dead

`scape_newlines` was introduced in #110271. Happy to drop the typo fix
if we don't want it

21 months agogh-113659: Skip hidden .pth files (GH-113660)
Serhiy Storchaka [Tue, 16 Jan 2024 18:23:05 +0000 (20:23 +0200)] 
gh-113659: Skip hidden .pth files (GH-113660)

Skip .pth files with names starting with a dot or hidden file attribute.

21 months agoFix 'expresion' typo in IDLE doc (#114130)
Terry Jan Reedy [Tue, 16 Jan 2024 17:12:59 +0000 (12:12 -0500)] 
Fix 'expresion' typo in IDLE doc (#114130)

The substantive change is on line 577/593. Rest is header/footer stuff ignored when displaying.

21 months agoDocs: Improve multiprocessing.SharedMemory reference (#114093)
Erlend E. Aasland [Tue, 16 Jan 2024 16:43:13 +0000 (17:43 +0100)] 
Docs: Improve multiprocessing.SharedMemory reference (#114093)

Align the multiprocessing shared memory docs with Diatáxis's
recommendations for references.

- use a parameter list for the SharedMemory.__init__() argument spec
- use the imperative mode
- use versionadded, not versionchanged, for added parameters
- reflow touched lines according to SemBr

21 months agogh-114096: Restore privileges in _winapi.CreateJunction after creating the junction...
Steve Dower [Tue, 16 Jan 2024 16:40:02 +0000 (16:40 +0000)] 
gh-114096: Restore privileges in _winapi.CreateJunction after creating the junction (GH-114089)

This avoids impact on later parts of the application which may be able to do things they otherwise shouldn't.

21 months agogh-114069: Revise Tutorial Methods paragraph (#114127)
Terry Jan Reedy [Tue, 16 Jan 2024 16:33:05 +0000 (11:33 -0500)] 
gh-114069: Revise Tutorial Methods paragraph (#114127)

Remove excess words in the first and third sentences.

21 months agoFix an incorrect comment in iobase_is_closed (GH-102952)
Jonathon Reinhart [Tue, 16 Jan 2024 16:27:17 +0000 (11:27 -0500)] 
Fix an incorrect comment in iobase_is_closed (GH-102952)

This comment appears to have been mistakenly copied from what is now
called iobase_check_closed() in commit 4d9aec022063.

Also unite the iobase_check_closed() code with the relevant comment.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
21 months agogh-114107: test.pythoninfo logs Windows Developer Mode (#114121)
Victor Stinner [Tue, 16 Jan 2024 16:23:46 +0000 (17:23 +0100)] 
gh-114107: test.pythoninfo logs Windows Developer Mode (#114121)

Also, don't skip the whole collect_windows() if ctypes is missing.

Log also ctypes.windll.shell32.IsUserAnAdmin().

21 months agogh-111968: Use per-thread freelists for PyContext in free-threading (gh-114122)
Donghee Na [Tue, 16 Jan 2024 16:14:56 +0000 (01:14 +0900)] 
gh-111968: Use per-thread freelists for PyContext in free-threading (gh-114122)

21 months agogh-113626: Add allow_code parameter in marshal functions (GH-113648)
Serhiy Storchaka [Tue, 16 Jan 2024 16:05:15 +0000 (18:05 +0200)] 
gh-113626: Add allow_code parameter in marshal functions (GH-113648)

Passing allow_code=False prevents serialization and de-serialization of
code objects which is incompatible between Python versions.

21 months agogh-102468: Document `PyCFunction_New*` and `PyCMethod_New` (GH-112557)
AN Long [Tue, 16 Jan 2024 15:17:03 +0000 (23:17 +0800)] 
gh-102468: Document `PyCFunction_New*` and `PyCMethod_New` (GH-112557)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
21 months agogh-114107: Fix importlib.resources symlink test if symlinks aren't supported (#114108)
Petr Viktorin [Tue, 16 Jan 2024 15:10:03 +0000 (16:10 +0100)] 
gh-114107: Fix importlib.resources symlink test if symlinks aren't supported (#114108)

gh-114107: Fix symlink test if symlinks aren't supported

21 months agogh-113858: GH Actions: Limit max ccache size for the asan build (GH-114113)
Petr Viktorin [Tue, 16 Jan 2024 13:21:16 +0000 (14:21 +0100)] 
gh-113858: GH Actions: Limit max ccache size for the asan build (GH-114113)

21 months agoDocs: Align multiprocessing.shared_memory docs with Sphinx recommendations (#114103)
Erlend E. Aasland [Tue, 16 Jan 2024 12:35:35 +0000 (13:35 +0100)] 
Docs: Align multiprocessing.shared_memory docs with Sphinx recommendations (#114103)

- add :class: and :mod: markups where needed
- fix incorrect escaping of a star in ShareableList arg spec
- mark up parameters with stars: *val*
- mark up list of built-in types using list markup
- remove unneeded parentheses from :meth: markups

21 months agogh-114077: Fix OverflowError in socket.sendfile() when pass count >2GiB (GH-114079)
Serhiy Storchaka [Tue, 16 Jan 2024 11:31:34 +0000 (13:31 +0200)] 
gh-114077: Fix OverflowError in socket.sendfile() when pass count >2GiB (GH-114079)

21 months agogh-113238: add Anchor to importlib.resources (#113801)
Mike Zimin [Tue, 16 Jan 2024 10:55:59 +0000 (13:55 +0300)] 
gh-113238: add Anchor to importlib.resources (#113801)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
21 months agogh-113358: Fix rendering tracebacks with exceptions with a broken __getattr__ (GH...
Jérome Perrin [Tue, 16 Jan 2024 09:49:24 +0000 (18:49 +0900)] 
gh-113358: Fix rendering tracebacks with exceptions with a broken __getattr__ (GH-113359)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
21 months agoGH-113655: Lower the C recursion limit on various platforms (GH-113944)
Mark Shannon [Tue, 16 Jan 2024 09:32:01 +0000 (09:32 +0000)] 
GH-113655: Lower the C recursion limit on various platforms (GH-113944)

21 months agogh-114101: Correct PyErr_Format arguments in _testcapi module (#114102)
AN Long [Tue, 16 Jan 2024 08:32:39 +0000 (16:32 +0800)] 
gh-114101: Correct PyErr_Format arguments in _testcapi module (#114102)

- use PyErr_SetString() iso. PyErr_Format() in parse_tuple_and_keywords()
- fix misspelled format specifier in CHECK_SIGNNESS() macro

21 months agogh-78502: Add a trackfd parameter to mmap.mmap() (GH-25425)
Zackery Spytz [Tue, 16 Jan 2024 07:51:46 +0000 (23:51 -0800)] 
gh-78502: Add a trackfd parameter to mmap.mmap() (GH-25425)

If *trackfd* is False, the file descriptor specified by *fileno*
will not be duplicated.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
21 months agogh-112087: Update list impl to be thread-safe with manual CS (gh-113863)
Donghee Na [Tue, 16 Jan 2024 00:11:14 +0000 (09:11 +0900)] 
gh-112087: Update list impl to be thread-safe with manual CS (gh-113863)

21 months agogh-91539: Small performance improvement of urrlib.request.getproxies_environment...
Raphaël Marinier [Mon, 15 Jan 2024 23:45:01 +0000 (00:45 +0100)] 
gh-91539: Small performance improvement of urrlib.request.getproxies_environment() (#108771)

 Small performance improvement of getproxies_environment() when there are many environment variables. In a benchmark with 5k environment variables not related to proxies, and 5 specifying proxies, we get a 10% walltime improvement.

21 months agogh-114070: correct the specification of ``digit`` in the float() docs (#114080)
Sergey B Kirpichev [Mon, 15 Jan 2024 22:19:59 +0000 (01:19 +0300)] 
gh-114070: correct the specification of ``digit`` in the float() docs (#114080)

21 months agogh-99437: runpy: decode path-like objects before setting globals
Kamil Turek [Mon, 15 Jan 2024 16:58:50 +0000 (17:58 +0100)] 
gh-99437: runpy: decode path-like objects before setting globals

21 months agogh-111968: Use per-thread slice_cache in free-threading (gh-113972)
Donghee Na [Mon, 15 Jan 2024 15:38:57 +0000 (00:38 +0900)] 
gh-111968: Use per-thread slice_cache in free-threading (gh-113972)

21 months agogh-112532: Fix memory block count for free-threaded build (gh-113995)
Sam Gross [Mon, 15 Jan 2024 15:37:36 +0000 (10:37 -0500)] 
gh-112532: Fix memory block count for free-threaded build (gh-113995)

This fixes `_PyInterpreterState_GetAllocatedBlocks()` and
`_Py_GetGlobalAllocatedBlocks()` in the free-threaded builds. The
gh-113263 change that introduced multiple mimalloc heaps per-thread
broke the logic for counting the number of allocated blocks. For subtle
reasons, this led to reported reference count leaks in the refleaks
buildbots.

21 months agogh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __complex__ (GH-109647)
Sergey B Kirpichev [Mon, 15 Jan 2024 15:04:17 +0000 (18:04 +0300)] 
gh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __complex__ (GH-109647)

`PyComplex_RealAsDouble()`/`PyComplex_ImagAsDouble` now try to convert
an object to a `complex` instance using its `__complex__()` method
before falling back to the ``__float__()`` method.

PyComplex_ImagAsDouble() also will not silently return 0.0 for
non-complex types anymore.  Instead we try to call PyFloat_AsDouble()
and return 0.0 only if this call is successful.

21 months agoGH-112354: `_GUARD_IS_TRUE_POP` side-exits to target the next instruction, not themse...
Mark Shannon [Mon, 15 Jan 2024 11:41:06 +0000 (11:41 +0000)] 
GH-112354: `_GUARD_IS_TRUE_POP` side-exits to target the next instruction, not themselves. (GH-114078)

21 months agogh-113666: Adding missing UF_ and SF_ flags to module 'stat' (#113667)
Ronald Oussoren [Mon, 15 Jan 2024 11:22:43 +0000 (12:22 +0100)] 
gh-113666: Adding missing UF_ and SF_ flags to module 'stat' (#113667)

Add some constants to module 'stat' that are used on macOS.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
21 months agogh-114075: Capture `test_compileall` stdout output (#114076)
Kirill Podoprigora [Mon, 15 Jan 2024 10:21:34 +0000 (13:21 +0300)] 
gh-114075: Capture `test_compileall` stdout output  (#114076)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
21 months agogh-109862: Fix test_create_subprocess_with_pidfd when it was run separately (GH-113991)
Serhiy Storchaka [Mon, 15 Jan 2024 07:26:49 +0000 (09:26 +0200)] 
gh-109862: Fix test_create_subprocess_with_pidfd when it was run separately (GH-113991)

21 months agogh-113317: Move FormatCounterFormatter into libclinic (#114066)
Erlend E. Aasland [Sun, 14 Jan 2024 23:09:26 +0000 (00:09 +0100)] 
gh-113317: Move FormatCounterFormatter into libclinic (#114066)

21 months agoReplace `pathlib._abc.PathModuleBase.splitroot()` with `splitdrive()` (#114065)
Barney Gale [Sun, 14 Jan 2024 23:06:04 +0000 (23:06 +0000)] 
Replace `pathlib._abc.PathModuleBase.splitroot()` with `splitdrive()` (#114065)

This allows users of the `pathlib-abc` PyPI package to use `posixpath` or
`ntpath` as a path module in versions of Python lacking
`os.path.splitroot()` (3.11 and before).

21 months agoAdd `pathlib._abc.PathModuleBase` (#113893)
Barney Gale [Sun, 14 Jan 2024 21:49:53 +0000 (21:49 +0000)] 
Add `pathlib._abc.PathModuleBase` (#113893)

Path modules provide a subset of the `os.path` API, specifically those
functions needed to provide `PurePathBase` functionality. Each
`PurePathBase` subclass references its path module via a `pathmod` class
attribute.

This commit adds a new `PathModuleBase` class, which provides abstract
methods that unconditionally raise `UnsupportedOperation`. An instance of
this class is assigned to `PurePathBase.pathmod`, replacing `posixpath`.
As a result, `PurePathBase` is no longer POSIX-y by default, and
all its methods raise `UnsupportedOperation` courtesy of `pathmod`.

Users who subclass `PurePathBase` or `PathBase` should choose the path
syntax by setting `pathmod` to `posixpath`, `ntpath`, `os.path`, or their
own subclass of `PathModuleBase`, as circumstances demand.

21 months agogh-101100: Fix Sphinx warnings in `howto/urllib2.rst` and `library/http.client.rst...
Hugo van Kemenade [Sun, 14 Jan 2024 20:38:53 +0000 (22:38 +0200)] 
gh-101100: Fix Sphinx warnings in `howto/urllib2.rst` and `library/http.client.rst` (#114060)

21 months agogh-113317: Move global utility functions into libclinic (#113986)
Erlend E. Aasland [Sun, 14 Jan 2024 18:26:09 +0000 (19:26 +0100)] 
gh-113317: Move global utility functions into libclinic (#113986)

Establish Tools/clinic/libclinic/utils.py and move the following
functions over there:

- compute_checksum()
- create_regex()
- write_file()

21 months agogh-111803: Support loading more deeply nested lists in binary plist format (GH-114024)
Serhiy Storchaka [Sat, 13 Jan 2024 13:26:55 +0000 (15:26 +0200)] 
gh-111803: Support loading more deeply nested lists in binary plist format (GH-114024)

It no longer uses the C stack. The depth of nesting is only limited by
Python recursion limit setting.

21 months agogh-114014: Update `fractions.Fraction()`'s rational parsing regex (#114015)
Crowthebird [Sat, 13 Jan 2024 12:02:39 +0000 (20:02 +0800)] 
gh-114014: Update `fractions.Fraction()`'s rational parsing regex (#114015)

Fix a bug in the regex used for parsing a string input to the `fractions.Fraction` constructor. That bug led to an inconsistent exception message being given for some inputs.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
21 months agogh-101225: Increase the socket backlog when creating a multiprocessing.connection...
Ronald Oussoren [Sat, 13 Jan 2024 09:48:33 +0000 (10:48 +0100)] 
gh-101225: Increase the socket backlog when creating a multiprocessing.connection.Listener (#113567)

Increase the backlog for multiprocessing.connection.Listener` objects created
 by `multiprocessing.manager` and `multiprocessing.resource_sharer` to
 significantly reduce the risk of getting a connection refused error when creating
 a `multiprocessing.connection.Connection` to them.

21 months agoAdd module docstring for `pathlib._abc`. (#113691)
Barney Gale [Sat, 13 Jan 2024 08:47:00 +0000 (08:47 +0000)] 
Add module docstring for `pathlib._abc`. (#113691)

21 months agopathlib ABCs: add `_raw_path` property (#113976)
Barney Gale [Sat, 13 Jan 2024 08:03:21 +0000 (08:03 +0000)] 
pathlib ABCs: add `_raw_path` property (#113976)

It's wrong for the `PurePathBase` methods to rely so much on `__str__()`.
Instead, they should treat the raw path(s) as opaque objects and leave the
details to `pathmod`.

This commit adds a `PurePathBase._raw_path` property and uses it through
many of the other ABC methods. These methods are all redefined in
`PurePath` and `Path`, so this has no effect on the public classes.

21 months agoGH-44626, GH-105476: Fix `ntpath.isabs()` handling of part-absolute paths (#113829)
Barney Gale [Sat, 13 Jan 2024 07:36:05 +0000 (07:36 +0000)] 
GH-44626, GH-105476: Fix `ntpath.isabs()` handling of part-absolute paths (#113829)

On Windows, `os.path.isabs()` now returns `False` when given a path that
starts with exactly one (back)slash. This is more compatible with other
functions in `os.path`, and with Microsoft's own documentation.

Also adjust `pathlib.PureWindowsPath.is_absolute()` to call
`ntpath.isabs()`, which corrects its handling of partial UNC/device paths
like `//foo`.

Co-authored-by: Jon Foster <jon@jon-foster.co.uk>
21 months agoGH-111798: skip `test_super_deep()` from `test_call` under pydebug builds on WASI...
Brett Cannon [Sat, 13 Jan 2024 00:29:16 +0000 (16:29 -0800)] 
GH-111798: skip `test_super_deep()` from `test_call` under pydebug builds on WASI (GH-114010)

21 months agogh-89159: Document missing TarInfo members (#91564)
Stanley [Fri, 12 Jan 2024 23:19:57 +0000 (15:19 -0800)] 
gh-89159: Document missing TarInfo members (#91564)

21 months agoGH-111801: set a lower recursion limit for `test_infintely_many_bases()` in `test_isi...
Brett Cannon [Fri, 12 Jan 2024 23:19:21 +0000 (15:19 -0800)] 
GH-111801: set a lower recursion limit for `test_infintely_many_bases()` in `test_isinstance` (#113997)

21 months agodatamodel: Fix a typo in ``object.__init_subclass__`` (#111599)
InSync [Fri, 12 Jan 2024 22:59:24 +0000 (05:59 +0700)] 
datamodel: Fix a typo in ``object.__init_subclass__`` (#111599)