]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
22 months agogh-76785: Fixes for test.support.interpreters (gh-112982)
Eric Snow [Tue, 12 Dec 2023 15:24:31 +0000 (08:24 -0700)] 
gh-76785: Fixes for test.support.interpreters (gh-112982)

This involves a number of changes for PEP 734.

22 months agogh-51944: fix type and missing addition in gh-112823 (#112996)
Ronald Oussoren [Tue, 12 Dec 2023 12:57:45 +0000 (13:57 +0100)] 
gh-51944: fix type and missing addition in gh-112823 (#112996)

Fix the defition of VDSUSP and add CCTS_OFLOW (which
was mentioned in NEWS, but not actually addded)

22 months agoGH-111485: Factor out tier 2 code generation from the rest of the interpreter code...
Mark Shannon [Tue, 12 Dec 2023 12:12:17 +0000 (12:12 +0000)] 
GH-111485: Factor out tier 2 code generation from the rest of the interpreter code generator (GH-112968)

22 months agogh-112970: Detect and use closefrom() when available (#112969)
Sam James [Tue, 12 Dec 2023 10:25:27 +0000 (10:25 +0000)] 
gh-112970: Detect and use closefrom() when available (#112969)

glibc-2.34 implements closefrom(3) using the same semantics as on BSD.
Check for closefrom() in configure and use the check result in
fileutils.c, rather than hardcoding a FreeBSD check.

Some implementations of closefrom() return an int. Explicitly discard
the return value by casting it to void, to avoid future compiler
warnings.

Signed-off-by: Sam James <sam@gentoo.org>
22 months agogh-87286: Add a number of LOG_* constants to syslog (#24432)
Ronald Oussoren [Tue, 12 Dec 2023 09:25:51 +0000 (10:25 +0100)] 
gh-87286: Add a number of LOG_* constants to syslog (#24432)

* bpo-43120: Add a number of LOG_* constants to syslog

This adds a number of syslog facilities to the syslogmodule.c.
These values are available on macOS.

* Switch contant documentation to the data directive

This fixes a CI warning and matches the pattern
used in the documentation for ``os``.

* Update Doc/library/syslog.rst

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
22 months agogh-112953: Rename idlelib/NEWS.txt to News3.txt and update (#112988)
Terry Jan Reedy [Tue, 12 Dec 2023 06:00:51 +0000 (01:00 -0500)] 
gh-112953: Rename idlelib/NEWS.txt to News3.txt and update (#112988)

22 months agogh-112983: Add the known magic value of 3495 for Python 3.11 bytecode (#112985)
wim glenn [Tue, 12 Dec 2023 01:47:12 +0000 (19:47 -0600)] 
gh-112983: Add the known magic value of 3495 for Python 3.11 bytecode (#112985)

Add the known magic value of 3495 for Python 3.11 bytecode

22 months agoA smattering of cleanups in uop debug output and lltrace (#112980)
Guido van Rossum [Tue, 12 Dec 2023 00:42:30 +0000 (16:42 -0800)] 
A smattering of cleanups in uop debug output and lltrace (#112980)

* Include destination T1 opcode in Error debug message
* Include destination T1 opcode in DEOPT debug message
* Remove obsolete comment from remove_unneeded_uops
* Change lltrace_instruction() to print caller's opcode/oparg

22 months agogh-112532: Require mimalloc in `--disable-gil` builds (gh-112883)
Sam Gross [Tue, 12 Dec 2023 00:04:48 +0000 (19:04 -0500)] 
gh-112532: Require mimalloc in `--disable-gil` builds (gh-112883)

22 months agogh-112978: Remove redundant condition inside `take_gil` (gh-112979)
Yan Yanchii [Mon, 11 Dec 2023 23:23:41 +0000 (00:23 +0100)] 
gh-112978: Remove redundant condition inside `take_gil` (gh-112979)

22 months agogh-71383: Update Tcl/Tk version in Windows to our patched build containing a targeted...
Steve Dower [Mon, 11 Dec 2023 21:54:17 +0000 (21:54 +0000)] 
gh-71383: Update Tcl/Tk version in Windows to our patched build containing a targeted upstream fix (GH-112973)

22 months agoGH-83162: Rename re.error for better clarity. (#101677)
achhina [Mon, 11 Dec 2023 20:45:08 +0000 (15:45 -0500)] 
GH-83162: Rename re.error for better clarity. (#101677)

Renamed re.error for clarity, and kept re.error for backward compatibility.
Updated idlelib files at TJR's request.
---------

Co-authored-by: Matthias Bussonnier <mbussonnier@ucmerced.edu>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
22 months agogh-90350: Optimize builtin functions min() and max() (GH-30286)
colorfulappl [Mon, 11 Dec 2023 19:27:06 +0000 (03:27 +0800)] 
gh-90350: Optimize builtin functions min() and max() (GH-30286)

Builtin functions min() and max() now use METH_FASTCALL

22 months agogh-112529: Use atomic operations for `gcstate->collecting` (#112533)
Sam Gross [Mon, 11 Dec 2023 18:33:21 +0000 (13:33 -0500)] 
gh-112529: Use atomic operations for `gcstate->collecting` (#112533)

* gh-112529: Use atomic operations for `gcstate->collecting`

The `collecting` field in `GCState` is used to prevent overlapping garbage
collections within the same interpreter. This is updated to use atomic
operations in order to be thread-safe in `--disable-gil` builds.

The GC code is refactored a bit to support this. More of the logic is pushed
down to `gc_collect_main()` so that we can safely order the logic setting
`collecting`, the selection of the generation, and the invocation of callbacks
with respect to the atomic operations and the (future) stop-the-world pauses.

The change uses atomic operations for both `--disable-gil` and the default
build (with the GIL) to avoid extra `#ifdef` guards and ease the maintenance
burden.

22 months agogh-108303: Move `double_const` to `test_import` where it belongs (#112108)
Nikita Sobolev [Mon, 11 Dec 2023 18:29:43 +0000 (21:29 +0300)] 
gh-108303: Move `double_const` to `test_import` where it belongs (#112108)

22 months agogh-112507: Detect Cygwin and MSYS with `uname` instead of `$OSTYPE` (GH-112508)
James Morris [Mon, 11 Dec 2023 17:27:15 +0000 (12:27 -0500)] 
gh-112507: Detect Cygwin and MSYS with `uname` instead of `$OSTYPE` (GH-112508)

Detect Cygwin and MSYS with `uname` instead of `$OSTYPE`

`$OSTYPE` is not defined by POSIX and may not be present in other shells.
`uname` is always available in any shell.

22 months agogh-111178: Avoid calling functions from incompatible pointer types in memoryobject...
Christopher Chavez [Mon, 11 Dec 2023 16:43:07 +0000 (10:43 -0600)] 
gh-111178: Avoid calling functions from incompatible pointer types in memoryobject.c (GH-112863)

* Make memory_clear() compatible with inquiry
* Make memory_traverse() compatible with traverseproc
* Make memory_dealloc() compatible with destructor
* Make memory_repr() compatible with reprfunc
* Make memory_hash() compatible with hashfunc
* Make memoryiter_next() compatible with iternextfunc
* Make memoryiter_traverse() compatible with traverseproc
* Make memoryiter_dealloc() compatible with destructor
* Make several functions compatible with getter
* Make a few functions compatible with getter
* Make memory_item() compatible with ssizeargfunc
* Make memory_subscript() compatible with binaryfunc
* Make memory_length() compatible with lenfunc
* Make memory_ass_sub() compatible with objobjargproc
* Make memory_releasebuf() compatible with releasebufferproc
* Make memory_getbuf() compatible with getbufferproc
* Make mbuf_clear() compatible with inquiry
* Make mbuf_traverse() compatible with traverseproc
* Make mbuf_dealloc() compatible with destructor

22 months agogh-94606: Fix error when message with Unicode surrogate not surrogateescaped string...
Sidney Markowitz [Mon, 11 Dec 2023 16:21:18 +0000 (05:21 +1300)] 
gh-94606: Fix error when message with Unicode surrogate not surrogateescaped string (GH-94641)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
22 months agogh-112898: warn about unsaved files when quitting IDLE on macOS (#112939)
Ronald Oussoren [Mon, 11 Dec 2023 14:22:36 +0000 (15:22 +0100)] 
gh-112898: warn about unsaved files when quitting IDLE on macOS (#112939)

* gh-112898: warn about unsaved files when quitting IDLE on macOS

Implement the TK function ``::tk::mac::Quit`` on macOS to
ensure that IDLE asks about saving unsaved files when
quitting IDLE.

Co-authored-by: Christopher Chavez chrischavez@gmx.us
22 months agoGH-111485: Factor out generation of uop IDs from cases generator. (GH-112877)
Mark Shannon [Mon, 11 Dec 2023 14:14:36 +0000 (14:14 +0000)] 
GH-111485: Factor out generation of uop IDs from cases generator. (GH-112877)

22 months agoFix SyntaxWarning in test_syntax.py (GH-112944)
Anthony Sottile [Mon, 11 Dec 2023 11:48:52 +0000 (06:48 -0500)] 
Fix SyntaxWarning in test_syntax.py (GH-112944)

22 months agogh-112943: Correctly compute end offsets for multiline tokens in the tokenize module...
Pablo Galindo Salgado [Mon, 11 Dec 2023 11:44:22 +0000 (11:44 +0000)] 
gh-112943: Correctly compute end offsets for multiline tokens in the tokenize module (#112949)

22 months agogh-101100: Improve documentation on function attributes (#112933)
Alex Waygood [Mon, 11 Dec 2023 10:00:42 +0000 (10:00 +0000)] 
gh-101100: Improve documentation on function attributes (#112933)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
22 months agoGH-101986: Support translation for Limited/Unstable API & Stable ABI (#107680)
Adam Turner [Sun, 10 Dec 2023 19:17:07 +0000 (19:17 +0000)] 
GH-101986: Support translation for Limited/Unstable API & Stable ABI (#107680)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
22 months agoDoc: c-api: fix order of PyMemberDef fields (#112879)
Inada Naoki [Sun, 10 Dec 2023 17:43:17 +0000 (02:43 +0900)] 
Doc: c-api: fix order of PyMemberDef fields (#112879)

22 months agoAdd a fuzzer for `Py_CompileStringExFlags` (#111721)
Brad Larsen [Sun, 10 Dec 2023 17:16:15 +0000 (12:16 -0500)] 
Add a fuzzer for `Py_CompileStringExFlags` (#111721)

22 months agoArgument Clinic: fix bare "type" in annotations (#112915)
Jelle Zijlstra [Sun, 10 Dec 2023 15:30:02 +0000 (07:30 -0800)] 
Argument Clinic: fix bare "type" in annotations (#112915)

Bare "type" in annotations should be equivalent to "type[Any]"; see
https://discuss.python.org/t/inconsistencies-between-type-and-type/37404
and python/mypy#16366. It's better to use "type[object]", which is
safer and unambiguous.

22 months agogh-110686: Test pattern matching with `runtime_checkable` protocols (#110687)
Nikita Sobolev [Sun, 10 Dec 2023 15:21:20 +0000 (18:21 +0300)] 
gh-110686: Test pattern matching with `runtime_checkable` protocols (#110687)

22 months agogh-101100: Fix Sphinx warning in library/http.cookies.rst (#112908)
Hugo van Kemenade [Sun, 10 Dec 2023 12:53:26 +0000 (14:53 +0200)] 
gh-101100: Fix Sphinx warning in library/http.cookies.rst (#112908)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
22 months agogh-109980: Fix test_tarfile_vs_tar on macOS (#112905)
Ronald Oussoren [Sun, 10 Dec 2023 11:38:49 +0000 (12:38 +0100)] 
gh-109980: Fix test_tarfile_vs_tar on macOS (#112905)

On recentish macOS versions the system tar
command includes system metadata (ACLs, extended attributes
and resource forks) in the tar archive, which
shutil.make_archive will not do. This can cause
spurious test failures.

22 months agoDocs: Use 'f-strings' as header (#112888)
Hugo van Kemenade [Sun, 10 Dec 2023 08:39:51 +0000 (10:39 +0200)] 
Docs: Use 'f-strings' as header (#112888)

22 months agoIDLE: Tweak iomenu.IOBinding.maybesave (#112914)
Terry Jan Reedy [Sun, 10 Dec 2023 02:29:40 +0000 (21:29 -0500)] 
IDLE: Tweak iomenu.IOBinding.maybesave  (#112914)

Add docstring, use f-string, simplify code.

23 months agoGH-112906: Fix performance regression in pathlib path initialisation (#112907)
Barney Gale [Sun, 10 Dec 2023 00:06:27 +0000 (00:06 +0000)] 
GH-112906: Fix performance regression in pathlib path initialisation (#112907)

This was caused by 76929fdeeb, specifically its use of `super()` and its
packing/unpacking `*args`.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
23 months agogh-101100: Improve documentation of `TracebackType` attributes (#112884)
Alex Waygood [Sat, 9 Dec 2023 22:43:53 +0000 (22:43 +0000)] 
gh-101100: Improve documentation of `TracebackType` attributes (#112884)

23 months agogh-101100: Fix Sphinx nitpicks in `library/tempfile.rst` (#112886)
Alex Waygood [Sat, 9 Dec 2023 22:08:01 +0000 (22:08 +0000)] 
gh-101100: Fix Sphinx nitpicks in `library/tempfile.rst` (#112886)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
23 months agogh-112867: fix for WITH_PYMALLOC_RADIX_TREE=0 (GH-112885)
Neil Schemenauer [Sat, 9 Dec 2023 21:50:48 +0000 (13:50 -0800)] 
gh-112867: fix for WITH_PYMALLOC_RADIX_TREE=0 (GH-112885)

The _obmalloc_usage structure is only defined if the obmalloc radix tree
is enabled.

23 months agogh-110109: Fix installed buildbots now `pathlib` is a package (#112901)
Alex Waygood [Sat, 9 Dec 2023 18:05:33 +0000 (18:05 +0000)] 
gh-110109: Fix installed buildbots now `pathlib` is a package (#112901)

23 months agoGH-110109: Move pathlib ABCs to new `pathlib._abc` module. (#112881)
Barney Gale [Sat, 9 Dec 2023 15:07:40 +0000 (15:07 +0000)] 
GH-110109: Move pathlib ABCs to new `pathlib._abc` module. (#112881)

Move `_PurePathBase` and `_PathBase` to a new `pathlib._abc` module, and
drop the underscores from the class names.

Tests are mostly left alone in this commit, but they'll be similarly split
in a subsequent commit.

The `pathlib._abc` module will be published as an independent PyPI package
(similar to how `zipfile._path` is published as `zipp`), to be refined
and stabilised prior to its possible addition to the standard library.

23 months agogh-112720: Move instruction formatting from the dis.Instruction class to a new class...
Irit Katriel [Sat, 9 Dec 2023 10:03:02 +0000 (10:03 +0000)] 
gh-112720: Move instruction formatting from the dis.Instruction class to a new class dis.InstructionFormatter. Add the ArgResolver class. (#112722)

23 months agogh-112334: Regression test that vfork is used when expected. (#112734)
Gregory P. Smith [Sat, 9 Dec 2023 00:18:35 +0000 (16:18 -0800)] 
gh-112334: Regression test that vfork is used when expected. (#112734)

Regression test that vfork is used when expected by subprocess.

This is written integration test style, it uses strace if it is present and appears to work to find out what system call actually gets used in different scenarios.

Test coverage is added for the default behavior and that of each of the specific arguments that must disable the use of vfork.  obviously not an entire test matrix, but it covers the most important aspects.

If there are ever issues with this test being flaky or failing on new platforms, rather than try and adapt it for all possible platforms, feel free to narrow the range it gets tested on when appropriate. That is not likely to reduce coverage.

23 months agogh-112758: Updated pathlib documentation for PurePath.match (#112814)
Taylor Packard [Fri, 8 Dec 2023 18:13:17 +0000 (13:13 -0500)] 
gh-112758: Updated pathlib documentation for PurePath.match (#112814)

23 months agogh-112540: Support zero inputs in geometric_mean() (gh-112880)
Raymond Hettinger [Fri, 8 Dec 2023 18:05:56 +0000 (12:05 -0600)] 
gh-112540: Support zero inputs in geometric_mean() (gh-112880)

23 months agoGH-110109: Add `pathlib._PurePathBase` (#110670)
Barney Gale [Fri, 8 Dec 2023 17:39:04 +0000 (17:39 +0000)] 
GH-110109: Add `pathlib._PurePathBase` (#110670)

Add private `pathlib._PurePathBase` class: a private superclass of both `PurePath` and `_PathBase`. Unlike `PurePath`, it does not define any of these special methods: `__fspath__`, `__bytes__`, `__reduce__`, `__hash__`, `__eq__`, `__lt__`, `__le__`, `__gt__`, `__ge__`. Its initializer and path joining methods accept only strings, not os.PathLike objects more broadly.

This is important for supporting *virtual paths*: user subclasses of `_PathBase` that provide access to archive files, FTP servers, etc. In these classes, the above methods should be implemented by users only as appropriate, with due consideration for the hash/equality of any backing objects, such as file objects or sockets.

23 months agogh-112278: In _wmi, treat initialization timeout separately from connection timeout...
AN Long [Fri, 8 Dec 2023 16:52:22 +0000 (00:52 +0800)] 
gh-112278: In _wmi, treat initialization timeout separately from connection timeout (GH-112878)

23 months agogh-112779: Check 1-byte atomics in configure (gh-112819)
Sam Gross [Fri, 8 Dec 2023 16:31:32 +0000 (11:31 -0500)] 
gh-112779: Check 1-byte atomics in configure (gh-112819)

23 months agogh-112535: Update _Py_ThreadId() to support s390/s390x (gh-112751)
Donghee Na [Fri, 8 Dec 2023 14:28:07 +0000 (14:28 +0000)] 
gh-112535: Update _Py_ThreadId() to support s390/s390x (gh-112751)

23 months agogh-112302: Annotate SBOM file as generated in .gitattributes (#112854)
Seth Michael Larson [Fri, 8 Dec 2023 13:46:19 +0000 (07:46 -0600)] 
gh-112302: Annotate SBOM file as generated in .gitattributes (#112854)

Annotate SBOM file as generated in .gitattributes

23 months agogh-101100: Improve documentation for attributes on instance methods (#112832)
Alex Waygood [Fri, 8 Dec 2023 13:18:53 +0000 (13:18 +0000)] 
gh-101100: Improve documentation for attributes on instance methods (#112832)

23 months agogh-101100: Fix Sphinx nits in `library/contextlib.rst` (#112870)
Alex Waygood [Fri, 8 Dec 2023 13:17:57 +0000 (13:17 +0000)] 
gh-101100: Fix Sphinx nits in `library/contextlib.rst` (#112870)

23 months agogh-101100: Fix Sphinx nitpicks in `library/shelve.rst` (#112836)
Alex Waygood [Fri, 8 Dec 2023 12:31:11 +0000 (12:31 +0000)] 
gh-101100: Fix Sphinx nitpicks in `library/shelve.rst` (#112836)

23 months agoGH-111485: Factor out opcode ID generator from the main cases generator. (GH-112831)
Mark Shannon [Fri, 8 Dec 2023 11:48:30 +0000 (11:48 +0000)] 
GH-111485: Factor out opcode ID generator from the main cases generator. (GH-112831)

23 months agogh-110820: Make sure processor specific defines are correct for Universal 2 build...
Ronald Oussoren [Fri, 8 Dec 2023 09:09:34 +0000 (10:09 +0100)] 
gh-110820: Make sure processor specific defines are correct for Universal 2 build on macOS (#112828)

* gh-110820: Make sure processor specific defines are correct for Universal 2 build on macOS

A number of processor specific defines are different for x86-64 and
arm64, and need to be adjusted in pymacconfig.h.

* remove debug stuf

23 months agoAdd a versionchanged directive for gh-94692 (GH-112846)
Serhiy Storchaka [Fri, 8 Dec 2023 08:18:15 +0000 (10:18 +0200)] 
Add a versionchanged directive for gh-94692 (GH-112846)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
23 months agoGH-112675: Move path joining tests into `test_posixpath` and `test_ntpath` (#112676)
Barney Gale [Thu, 7 Dec 2023 21:45:40 +0000 (21:45 +0000)] 
GH-112675: Move path joining tests into `test_posixpath` and `test_ntpath` (#112676)

In `test_pathlib`, the `check_drive_root_parts` test methods evaluated
both joining and parsing/normalisation of paths. This dates from a time
when pathlib implemented both functions itself, but nowadays path joining
is done with `posixpath.join()` and `ntpath.join()`.

This commit moves the joining-related test cases into `test_posixpath` and
`test_ntpath`.

23 months agogh-101100: Silence Sphinx warnings when `ntpath` or `posixpath` are referenced (...
Alex Waygood [Thu, 7 Dec 2023 20:57:30 +0000 (20:57 +0000)] 
gh-101100: Silence Sphinx warnings when `ntpath` or `posixpath` are referenced (#112833)

23 months agogh-112826: Add a "What's New" Entry About _thread._is_main_interpreter (gh-112853)
Eric Snow [Thu, 7 Dec 2023 20:22:15 +0000 (13:22 -0700)] 
gh-112826: Add a "What's New" Entry About _thread._is_main_interpreter (gh-112853)

As of gh-112661, the threading module expects the _thread module to have a _is_main_interpreter(), which is used in the internal threading._shutdown().  This change causes a problem for anyone that replaces the _thread module with a custom one (only if they don't provide _is_main_interpreter()).  They need to be sure to add it for 3.13+, thus this PR is adding a note in "What's New".

This also forward-ports the "What's New" entry from 3.12 (gh-112850).  Note that we do not also forward-port the fix in that PR.  The fix is there only due to a regression from 3.12.0. There is no regression in 3.13+.

23 months agogh-111924: Use PyMutex for Runtime-global Locks. (gh-112207)
Sam Gross [Thu, 7 Dec 2023 19:33:40 +0000 (14:33 -0500)] 
gh-111924: Use PyMutex for Runtime-global Locks. (gh-112207)

This replaces some usages of PyThread_type_lock with PyMutex, which does not require memory allocation to initialize.

This simplifies some of the runtime initialization and is also one step towards avoiding changing the default raw memory allocator during initialize/finalization, which can be non-thread-safe in some circumstances.

23 months agogh-112538: Add internal-only _PyThreadStateImpl "wrapper" for PyThreadState (gh-112560)
Sam Gross [Thu, 7 Dec 2023 19:11:45 +0000 (14:11 -0500)] 
gh-112538: Add internal-only _PyThreadStateImpl "wrapper" for PyThreadState (gh-112560)

Every PyThreadState instance is now actually a _PyThreadStateImpl.
It is safe to cast from `PyThreadState*` to `_PyThreadStateImpl*` and back.
The _PyThreadStateImpl will contain fields that we do not want to expose
in the public C API.

23 months agogh-110017: Disable test_signal.test_stress_modifying_handlers on macOS (#112834)
Ronald Oussoren [Thu, 7 Dec 2023 18:41:27 +0000 (19:41 +0100)] 
gh-110017: Disable test_signal.test_stress_modifying_handlers on macOS (#112834)

Test test_stress_modifying_handlers in test_signal can crash
the interpreter due to a bug in macOS. Filed as FB13453490
with Apple.

23 months agogh-112278: Disable WMI queries on Windows after they time out (GH-112658)
AN Long [Thu, 7 Dec 2023 17:26:29 +0000 (01:26 +0800)] 
gh-112278: Disable WMI queries on Windows after they time out (GH-112658)

23 months agogh-79325: Fix recursion error in TemporaryDirectory cleanup on Windows (GH-112762)
Serhiy Storchaka [Thu, 7 Dec 2023 17:21:36 +0000 (19:21 +0200)] 
gh-79325: Fix recursion error in TemporaryDirectory cleanup on Windows (GH-112762)

23 months agogh-87319: Simplify TemporaryDirectory cleanup using os.path.isjunction() (GH-112791)
Serhiy Storchaka [Thu, 7 Dec 2023 16:32:10 +0000 (18:32 +0200)] 
gh-87319: Simplify TemporaryDirectory cleanup using os.path.isjunction() (GH-112791)

23 months agogh-91133: tempfile.TemporaryDirectory: fix symlink bug in cleanup (GH-99930)
Søren Løvborg [Thu, 7 Dec 2023 16:04:06 +0000 (17:04 +0100)] 
gh-91133: tempfile.TemporaryDirectory: fix symlink bug in cleanup (GH-99930)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
23 months agogh-112302: Add Software Bill-of-Materials (SBOM) tracking for dependencies (#112303)
Seth Michael Larson [Thu, 7 Dec 2023 16:01:58 +0000 (10:01 -0600)] 
gh-112302: Add Software Bill-of-Materials (SBOM) tracking for dependencies (#112303)

23 months agogh-111962: Make dtoa thread-safe in `--disable-gil` builds. (#112049)
Sam Gross [Thu, 7 Dec 2023 13:47:55 +0000 (08:47 -0500)] 
gh-111962: Make dtoa thread-safe in `--disable-gil` builds. (#112049)

This updates `dtoa.c` to avoid using the Bigint free-list in --disable-gil builds and
to pre-computes the needed powers of 5 during interpreter initialization.

* gh-111962: Make dtoa thread-safe in `--disable-gil` builds.

This avoids using the Bigint free-list in `--disable-gil` builds
and pre-computes the needed powers of 5 during interpreter initialization.

* Fix size of cached powers of 5 array.

We need the powers of 5 up to 5**512 because we only jump straight to
underflow when the exponent is less than -512 (or larger than 308).

* Rename Py_NOGIL to Py_GIL_DISABLED

* Changes from review

* Fix assertion placement

23 months agogh-110190: Temporarily skip new test introduced in gh-112604 on PPC64LE (#112818)
Łukasz Langa [Thu, 7 Dec 2023 13:29:15 +0000 (14:29 +0100)] 
gh-110190: Temporarily skip new test introduced in gh-112604 on PPC64LE (#112818)

23 months agobpo-42519: Remove outdated sentence in comment (#112822)
Christopher Chavez [Thu, 7 Dec 2023 13:24:11 +0000 (07:24 -0600)] 
bpo-42519: Remove outdated sentence in comment (#112822)

Update objimpl.h

23 months agogh-112125: Fix None.__ne__(None) returning NotImplemented instead of False (#112504)
andrewluotechnologies [Thu, 7 Dec 2023 12:56:01 +0000 (04:56 -0800)] 
gh-112125: Fix None.__ne__(None) returning NotImplemented instead of False (#112504)

23 months agoGH-111485: Separate out parsing, analysis and code-gen phases of tier 1 code generato...
Mark Shannon [Thu, 7 Dec 2023 12:49:40 +0000 (12:49 +0000)] 
GH-111485: Separate out parsing, analysis and code-gen phases of tier 1 code generator (GH-112299)

23 months agogh-102980: Redirect output of pdb's `interact` command, add tests and improve docs...
Tian Gao [Thu, 7 Dec 2023 11:19:33 +0000 (02:19 -0900)] 
gh-102980: Redirect output of pdb's `interact` command, add tests and improve docs (#111194)

23 months agogh-51944: Add missing macOS constants to termios (#112823)
Ronald Oussoren [Thu, 7 Dec 2023 10:27:30 +0000 (11:27 +0100)] 
gh-51944: Add missing macOS constants to termios (#112823)

* gh-51944: Add some macOS constants to termios

This changeset adds all public constants in <termio.h>
and <sys/termios.h> on macOS that weren't present
already.

Based on the macOS 14.2 SDK

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
23 months agogh-74616: Raise ValueError in case of null character in input prompt (GH-1738)
Kushal Das [Thu, 7 Dec 2023 10:22:52 +0000 (11:22 +0100)] 
gh-74616: Raise ValueError in case of null character in input prompt (GH-1738)

If the input prompt to the builtin input function on terminal has any null
character, then raise ValueError instead of silently truncating it.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
23 months agogh-112660: Do not clear arbitrary errors on import (GH-112661)
Serhiy Storchaka [Thu, 7 Dec 2023 10:19:43 +0000 (12:19 +0200)] 
gh-112660: Do not clear arbitrary errors on import (GH-112661)

Previously arbitrary errors could be cleared during formatting error
messages for ImportError or AttributeError for modules. Now all
unexpected errors are reported.

23 months agogh-109981: Fix support.fd_count() on macOS 14 (#112797)
Ronald Oussoren [Thu, 7 Dec 2023 09:30:15 +0000 (10:30 +0100)] 
gh-109981: Fix support.fd_count() on macOS 14 (#112797)

Use scanning "/dev/fd/" on macOS in support.fd_count(). That's both more efficient than scanning all possible file descriptors, and avoids crashing the interpreter when there are open "guarded" file descriptors.

"Guarded" file descriptors are a macOS feature where file descriptors used by system libraries are marked and cause hard crashes when used by "user" code.

Co-authored-by: Victor Stinner <vstinner@python.org>
23 months agogh-112730: Use color to highlight error locations (gh-112732)
Pablo Galindo Salgado [Wed, 6 Dec 2023 22:29:54 +0000 (22:29 +0000)] 
gh-112730: Use color to highlight error locations (gh-112732)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
23 months agogh-101100: Fix Sphinx nitpicks in `library/reprlib.rst` (#112811)
Alex Waygood [Wed, 6 Dec 2023 20:16:12 +0000 (20:16 +0000)] 
gh-101100: Fix Sphinx nitpicks in `library/reprlib.rst` (#112811)

23 months agogh-101100: Improve documentation of code object attributes (#112781)
Alex Waygood [Wed, 6 Dec 2023 20:15:46 +0000 (20:15 +0000)] 
gh-101100: Improve documentation of code object attributes (#112781)

23 months agogh-111178: Define `visitproc` callback functions properly and remove unnecessary...
Christopher Chavez [Wed, 6 Dec 2023 15:30:37 +0000 (09:30 -0600)] 
gh-111178: Define `visitproc` callback functions properly and remove unnecessary casts in gcmodule.c (#112687)

23 months agogh-75666: Tkinter: "unbind(sequence, funcid)" now only unbinds "funcid" (GH-111322)
Serhiy Storchaka [Wed, 6 Dec 2023 14:42:15 +0000 (16:42 +0200)] 
gh-75666: Tkinter: "unbind(sequence, funcid)" now only unbinds "funcid" (GH-111322)

Previously, "widget.unbind(sequence, funcid)" destroyed the current binding
for "sequence", leaving "sequence" unbound, and deleted the "funcid"
command.

Now it removes only "funcid" from the binding for "sequence", keeping
other commands, and deletes the "funcid" command.
It leaves "sequence" unbound only if "funcid" was the last bound command.

Co-authored-by: GiovanniL <13402461+GiovaLomba@users.noreply.github.com>
23 months agogh-111545: Add Py_HashPointer() function (#112096)
Victor Stinner [Wed, 6 Dec 2023 14:09:22 +0000 (15:09 +0100)] 
gh-111545: Add Py_HashPointer() function (#112096)

* Implement _Py_HashPointerRaw() as a static inline function.
* Add Py_HashPointer() tests to test_capi.test_hash.
* Keep _Py_HashPointer() function as an alias to Py_HashPointer().

23 months agogh-108223: Refer to PEP 703 as Free Threading (#112780)
Victor Stinner [Wed, 6 Dec 2023 11:55:58 +0000 (12:55 +0100)] 
gh-108223: Refer to PEP 703 as Free Threading (#112780)

23 months agogh-111178: Docs: fix `traverseproc`, `inquiry`, and `destructor` parameters in slot...
Christopher Chavez [Wed, 6 Dec 2023 09:44:41 +0000 (03:44 -0600)] 
gh-111178: Docs: fix `traverseproc`, `inquiry`, and `destructor` parameters in slot typedefs table (GH-112742)

In the slot typedefs table, the parameter of `destructor`
and the first parameter of `traverseproc` should both be
`PyObject *` rather than `void *`.
Same for `inquiry`.

23 months agogh-101100: Fix most Sphinx nitpicks in the glossary and `stdtypes.rst` (#112757)
Alex Waygood [Wed, 6 Dec 2023 08:44:06 +0000 (08:44 +0000)] 
gh-101100: Fix most Sphinx nitpicks in the glossary and `stdtypes.rst` (#112757)

23 months agogh-108927: Include new dir test/regrtestdata in the installation (GH-112765)
Serhiy Storchaka [Wed, 6 Dec 2023 07:48:27 +0000 (09:48 +0200)] 
gh-108927: Include new dir test/regrtestdata in the installation (GH-112765)

Co-authored-by: Victor Stinner <vstinner@python.org>
23 months agogh-112606: Use sem_clockwait with monotonic time when supported in parking_lot.c...
Matt Prodani [Wed, 6 Dec 2023 06:54:57 +0000 (01:54 -0500)] 
gh-112606: Use sem_clockwait with monotonic time when supported in parking_lot.c (gh-112733)

23 months agogh-112769: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix...
Miro Hrončok [Tue, 5 Dec 2023 19:39:28 +0000 (20:39 +0100)] 
gh-112769: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix (GH-112771)

zlib-ng defines the version as "1.3.0.zlib-ng".

23 months agogh-101100: Properly document frame object attributes (#112735)
Alex Waygood [Tue, 5 Dec 2023 19:27:59 +0000 (19:27 +0000)] 
gh-101100: Properly document frame object attributes (#112735)

23 months agoMinor stylistic edit to the grouper recipe (gh112759)
Jurjen N. E. Bos [Tue, 5 Dec 2023 18:44:06 +0000 (19:44 +0100)] 
Minor stylistic edit to the grouper recipe (gh112759)

23 months agobpo-35332: Handle os.close() errors in shutil.rmtree() (GH-23766)
Zackery Spytz [Tue, 5 Dec 2023 17:09:39 +0000 (09:09 -0800)] 
bpo-35332: Handle os.close() errors in shutil.rmtree() (GH-23766)

* Ignore os.close() errors when ignore_errors is True.
* Pass os.close() errors to the error handler if specified.
* os.close no longer retried after error.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
23 months agogh-112328: [Enum] Make some private attributes public. (GH-112514)
Ethan Furman [Tue, 5 Dec 2023 16:27:36 +0000 (08:27 -0800)] 
gh-112328: [Enum] Make some private attributes public. (GH-112514)

* [Enum] Make some private attributes public.

- ``_EnumDict`` --> ``EnumDict``
- ``EnumDict._member_names`` --> ``EnumDict.member_names``
- ``Enum._add_alias_``
- ``Enum._add_value_alias_``

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
23 months agogh-94692: Only catch OSError in shutil.rmtree() (#112756)
Serhiy Storchaka [Tue, 5 Dec 2023 15:40:49 +0000 (17:40 +0200)] 
gh-94692: Only catch OSError in shutil.rmtree() (#112756)

Previously a symlink attack resistant version of shutil.rmtree() could ignore
or pass to the error handler arbitrary exception when invalid arguments
were provided.

23 months agogh-110190: Fix ctypes structs with array on Arm (#112604)
Diego Russo [Tue, 5 Dec 2023 15:07:50 +0000 (15:07 +0000)] 
gh-110190: Fix ctypes structs with array on Arm (#112604)

Set MAX_STRUCT_SIZE to 32 in stgdict.c when on Arm platforms.
This because on Arm platforms structs with at most 4 elements of any
floating point type values can be passed through registers. If the type
is double the maximum size of the struct is 32 bytes.
On x86-64 Linux, it's maximum 16 bytes hence we need to differentiate.

23 months agogh-105323: Remove `WITH_APPLE_EDITLINE` to use the same declaration for all editline...
Tian Gao [Tue, 5 Dec 2023 14:52:28 +0000 (05:52 -0900)] 
gh-105323: Remove `WITH_APPLE_EDITLINE` to use the same declaration for all editline (gh-112513)

23 months agobpo-43153: Don't mask `PermissionError` with `NotADirectoryError` during tempdirector...
Ken Jin [Tue, 5 Dec 2023 13:30:59 +0000 (21:30 +0800)] 
bpo-43153: Don't mask `PermissionError` with `NotADirectoryError` during tempdirectory cleanup (GH-29940)

Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
23 months agogh-112535: Add comment for ppc32/64 registers (gh-112746)
Donghee Na [Tue, 5 Dec 2023 10:44:19 +0000 (10:44 +0000)] 
gh-112535: Add comment for ppc32/64 registers (gh-112746)

23 months agogh-101100: Fix many easily solvable Sphinx nitpicks in the datamodel docs (#112737)
Alex Waygood [Tue, 5 Dec 2023 09:59:52 +0000 (09:59 +0000)] 
gh-101100: Fix many easily solvable Sphinx nitpicks in the datamodel docs (#112737)

23 months agogh-81441: shutil.rmtree() FileNotFoundError race condition (GH-14064)
Jeffrey Kintscher [Tue, 5 Dec 2023 09:33:51 +0000 (01:33 -0800)] 
gh-81441: shutil.rmtree() FileNotFoundError race condition (GH-14064)

Ignore missing files and directories while enumerating
directory entries in shutil.rmtree().

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
23 months agogh-62897: Update PyUnicode C API parameter names (GH-12680)
Rune Tynan [Tue, 5 Dec 2023 09:21:09 +0000 (04:21 -0500)] 
gh-62897: Update PyUnicode C API parameter names (GH-12680)

Standardize PyUnicode C API parameter names across the documentation.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
23 months agogh-112535: Update _Py_ThreadId() to support PowerPC (gh-112624)
Donghee Na [Tue, 5 Dec 2023 09:03:32 +0000 (09:03 +0000)] 
gh-112535: Update _Py_ThreadId() to support PowerPC (gh-112624)

23 months agogh-82300: Add track parameter to multiprocessing.shared_memory (#110778)
pan324 [Tue, 5 Dec 2023 08:11:44 +0000 (09:11 +0100)] 
gh-82300: Add track parameter to multiprocessing.shared_memory (#110778)

Add a track parameter to shared memory to allow resource tracking via the side-launched resource tracker process to be disabled on platforms that use it (POSIX).

This allows people who do not want automated cleanup at process exit because they are using the shared memory with processes not participating in Python's resource tracking to use the shared_memory API.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
Co-authored-by: Gregory P. Smith <greg@krypto.org>