]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
21 months agogh-114241: Fix and improve the ftplib CLI (GH-114242)
Serhiy Storchaka [Sun, 21 Jan 2024 20:16:45 +0000 (22:16 +0200)] 
gh-114241: Fix and improve the ftplib CLI (GH-114242)

* Fix writing the retrieved binary file to stdout.
* Add a newline after writing warnings to stderr.
* Fix a TypeError if the netrc file doesn't contain a host/default entry.
* Improve the usage message.

21 months agoDocs: align sqlite3 docs with versionadded/versionchanged recommendations (#114400)
Erlend E. Aasland [Sun, 21 Jan 2024 19:54:19 +0000 (20:54 +0100)] 
Docs: align sqlite3 docs with versionadded/versionchanged recommendations (#114400)

When a parameter is added to a function or method, use the 'versionchanged'
directive, not 'versionadded'.

21 months agoDocs: link to sys.stdout in ftplib docs (#114396)
Erlend E. Aasland [Sun, 21 Jan 2024 17:41:21 +0000 (18:41 +0100)] 
Docs: link to sys.stdout in ftplib docs (#114396)

21 months agogh-114384: Align sys.set_asyncgen_hooks signature in docs to reflect implementation...
Nikita Sobolev [Sun, 21 Jan 2024 12:49:49 +0000 (15:49 +0300)] 
gh-114384: Align sys.set_asyncgen_hooks signature in docs to reflect implementation (#114385)

21 months agoDocs: mark up FTP() constructor with param list (#114359)
Erlend E. Aasland [Sun, 21 Jan 2024 11:27:33 +0000 (12:27 +0100)] 
Docs: mark up FTP() constructor with param list (#114359)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
21 months agogh-80931: Skip some socket tests while hunting for refleaks on macOS (#114057)
Ronald Oussoren [Sun, 21 Jan 2024 10:25:15 +0000 (11:25 +0100)] 
gh-80931: Skip some socket tests while hunting for refleaks on macOS (#114057)

Some socket tests related to sending file descriptors cause a file descriptor leak on macOS, all of them tests that send one or more descriptors than cannot be received on the read end.  This appears to be a platform bug.

This PR skips those tests when doing a refleak test run to avoid hiding other problems.

21 months agogh-101100: Fix sphinx warnings in `Doc/c-api/memory.rst` (#114373)
Nikita Sobolev [Sun, 21 Jan 2024 09:34:43 +0000 (12:34 +0300)] 
gh-101100: Fix sphinx warnings in `Doc/c-api/memory.rst` (#114373)

21 months agoDocs: mark up the FTP debug levels as a list (#114360)
Erlend E. Aasland [Sun, 21 Jan 2024 09:19:31 +0000 (10:19 +0100)] 
Docs: mark up the FTP debug levels as a list (#114360)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
21 months agoFix the confusing "User-defined methods" reference in the datamodel (#114276)
cdzhan [Sun, 21 Jan 2024 03:45:38 +0000 (11:45 +0800)] 
Fix the confusing "User-defined methods" reference in the datamodel (#114276)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
21 months agoRemove deleted `time_hashlib.py` from `Lib/test/.ruff.toml` (#114355)
Hugo van Kemenade [Sat, 20 Jan 2024 21:10:43 +0000 (23:10 +0200)] 
Remove deleted `time_hashlib.py` from `Lib/test/.ruff.toml` (#114355)

21 months agoRemove the non-test Lib/test/time_hashlib.py. (#114354)
Gregory P. Smith [Sat, 20 Jan 2024 20:09:50 +0000 (12:09 -0800)] 
Remove the non-test Lib/test/time_hashlib.py. (#114354)

I believe I added this while chasing some performance of hash functions
when I first created hashlib.  It hasn't been used since, is frankly
trivial, and not a test.

21 months agoDocs: Add missing line continuation to FTP_TLS class docs (#114352)
Erlend E. Aasland [Sat, 20 Jan 2024 19:39:44 +0000 (20:39 +0100)] 
Docs: Add missing line continuation to FTP_TLS class docs (#114352)

Regression introduced by b1ad5a5d4.

21 months agogh-114281: Remove incorrect type hints from `asyncio.staggered` (#114282)
Nikita Sobolev [Sat, 20 Jan 2024 16:49:48 +0000 (19:49 +0300)] 
gh-114281: Remove incorrect type hints from `asyncio.staggered` (#114282)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
21 months agogh-112529: Use GC heaps for GC allocations in free-threaded builds (gh-114157)
Sam Gross [Sat, 20 Jan 2024 16:14:45 +0000 (11:14 -0500)] 
gh-112529: Use GC heaps for GC allocations in free-threaded builds (gh-114157)

* gh-112529: Use GC heaps for GC allocations in free-threaded builds

The free-threaded build's garbage collector implementation will need to
find GC objects by traversing mimalloc heaps. This hooks up the
allocation calls with the correct heaps by using a thread-local
"current_obj_heap" variable.

* Refactor out setting heap based on type

21 months agoDocs: structure the ftplib reference (#114317)
Erlend E. Aasland [Sat, 20 Jan 2024 15:06:52 +0000 (16:06 +0100)] 
Docs: structure the ftplib reference (#114317)

Introduce the following headings and subheadings:

- Reference
  * FTP objects
  * FTP_TLS objects
  * Module variables

21 months agoGH-99380: Update to Sphinx 7 (#99381)
Adam Turner [Sat, 20 Jan 2024 11:20:51 +0000 (11:20 +0000)] 
GH-99380: Update to Sphinx 7 (#99381)

21 months agogh-114332: Fix the flags reference for ``re.compile()`` (#114334)
David H. Gutteridge [Sat, 20 Jan 2024 11:17:41 +0000 (06:17 -0500)] 
gh-114332: Fix the flags reference for ``re.compile()`` (#114334)

The GH-93000 change set inadvertently caused a sentence in re.compile()
documentation to refer to details that no longer followed. Correct this
with a link to the Flags sub-subsection.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
21 months agoGH-113225: Speed up `pathlib.Path.walk(top_down=False)` (#113693)
Barney Gale [Sat, 20 Jan 2024 03:06:00 +0000 (03:06 +0000)] 
GH-113225: Speed up `pathlib.Path.walk(top_down=False)` (#113693)

Use `_make_child_entry()` rather than `_make_child_relpath()` to retrieve
path objects for directories to visit. This saves the allocation of one
path object per directory in user subclasses of `PathBase`, and avoids a
second loop.

This trick does not apply when walking top-down, because users can affect
the walk by modifying *dirnames* in-place.

A side effect of this change is that, in bottom-up mode, subdirectories of
each directory are visited in reverse order, and that this order doesn't
match that of the names in *dirnames*. I suspect this is fine as the
order is arbitrary anyway.

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)