]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
5 months agoAdd recipe for totient() to demonstrate unique_justseen() and factor(). (gh-113131)
Raymond Hettinger [Thu, 14 Dec 2023 19:15:29 +0000 (13:15 -0600)] 
Add recipe for totient() to demonstrate unique_justseen() and factor(). (gh-113131)

5 months agogh-105912: document gotcha with using os.fork on macOS (#112871)
Ronald Oussoren [Thu, 14 Dec 2023 19:14:50 +0000 (20:14 +0100)] 
gh-105912: document gotcha with using os.fork on macOS (#112871)

* gh-105912: document gotcha with using os.fork on macOS

Using ``fork(2)`` on macOS when also using higher-level
system APIs in the parent proces can crash on macOS because
those system APIs are not written to handle this usage
pattern.

There's nothing we can do about this other than documenting
the problem.

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
5 months agobpo-36796: Clean the error handling in _testcapimodule.c (GH-13085)
Zackery Spytz [Thu, 14 Dec 2023 19:06:53 +0000 (11:06 -0800)] 
bpo-36796: Clean the error handling in _testcapimodule.c (GH-13085)

5 months agoGH-111485: Sort metadata tables for easier checking of future diffs (GH-113101)
Mark Shannon [Thu, 14 Dec 2023 16:41:52 +0000 (16:41 +0000)] 
GH-111485: Sort metadata tables for easier checking of future diffs (GH-113101)

5 months agogh-113113: doc: use less ambiguously named variable (gh-113114)
jeremy-dolan [Thu, 14 Dec 2023 15:40:24 +0000 (10:40 -0500)] 
gh-113113: doc: use less ambiguously named variable (gh-113114)

5 months agogh-86179: Avoid making case-only changes when calculating realpath() during initializ...
Steve Dower [Thu, 14 Dec 2023 15:16:39 +0000 (15:16 +0000)] 
gh-86179: Avoid making case-only changes when calculating realpath() during initialization (GH-113077)

5 months agoGH-112354: Treat _EXIT_TRACE like an unconditional side exit (GH-113104)
Mark Shannon [Thu, 14 Dec 2023 14:26:44 +0000 (14:26 +0000)] 
GH-112354: Treat _EXIT_TRACE like an unconditional side exit (GH-113104)

5 months agogh-101100: Fix Sphinx nitpicks in `library/traceback.rst` (#113106)
Alex Waygood [Thu, 14 Dec 2023 14:10:35 +0000 (14:10 +0000)] 
gh-101100: Fix Sphinx nitpicks in `library/traceback.rst` (#113106)

5 months agogh-101100: Fix Sphinx nitpicks in `library/inspect.rst` and `reference/simple_stmts...
Alex Waygood [Thu, 14 Dec 2023 13:30:57 +0000 (13:30 +0000)] 
gh-101100: Fix Sphinx nitpicks in `library/inspect.rst` and `reference/simple_stmts.rst` (#113107)

5 months agogh-112716: Fix SystemError when __builtins__ is not a dict (GH-112770)
Serhiy Storchaka [Thu, 14 Dec 2023 12:24:24 +0000 (14:24 +0200)] 
gh-112716: Fix SystemError when __builtins__ is not a dict (GH-112770)

It was raised in two cases:
* in the import statement when looking up __import__
* in pickling some builtin type when looking up built-ins iter, getattr, etc.

5 months agogh-112730: Update docs for colour env vars (#112837)
Hugo van Kemenade [Thu, 14 Dec 2023 11:36:48 +0000 (13:36 +0200)] 
gh-112730: Update docs for colour env vars (#112837)

5 months agogh-59616: Support os.chmod(follow_symlinks=True) and os.lchmod() on Windows (GH-113049)
Serhiy Storchaka [Thu, 14 Dec 2023 11:28:37 +0000 (13:28 +0200)] 
gh-59616: Support os.chmod(follow_symlinks=True) and os.lchmod() on Windows (GH-113049)

5 months agogh-113090: Fix test.support.os_support.can_chmod() on Windows (GH-113091)
Serhiy Storchaka [Thu, 14 Dec 2023 11:27:43 +0000 (13:27 +0200)] 
gh-113090: Fix test.support.os_support.can_chmod() on Windows (GH-113091)

5 months agogh-112205: Update textio module to use `@getter` as possible. (gh-113095)
Donghee Na [Thu, 14 Dec 2023 10:26:46 +0000 (10:26 +0000)] 
gh-112205: Update textio module to use `@getter` as possible. (gh-113095)

5 months agoFixing typo in DocTestRunner docs (GH-112326)
Daniel Wysocki [Thu, 14 Dec 2023 10:07:37 +0000 (04:07 -0600)] 
Fixing typo in DocTestRunner docs (GH-112326)

5 months agogh-111049: Fix crash during garbage collection of the BytesIO buffer object (GH-111221)
Serhiy Storchaka [Thu, 14 Dec 2023 10:04:23 +0000 (12:04 +0200)] 
gh-111049: Fix crash during garbage collection of the BytesIO buffer object (GH-111221)

5 months agogh-90890: Reorder mailbox.Maildir method documentation (GH-113071)
Stephen Gildea [Thu, 14 Dec 2023 07:53:08 +0000 (23:53 -0800)] 
gh-90890: Reorder mailbox.Maildir method documentation (GH-113071)

When new mailbox.Maildir methods were added for 3.13.0a2, their
documentation was added at the end of the mailbox.Maildir section
instead of grouping them with other methods Maildir adds to Mailbox.

This commit moves the new methods' documentation adjacent to
documentation for existing Maildir-specific methods, so that
the "special remarks" for common methods remains at the end.

5 months agogh-113086: Add tests for os.chmod() and os.lchmod() (GH-113087)
Serhiy Storchaka [Thu, 14 Dec 2023 07:16:06 +0000 (09:16 +0200)] 
gh-113086: Add tests for os.chmod() and os.lchmod() (GH-113087)

Also make test_copymode_symlink_to_symlink in test_shutil more strict.

5 months agogh-86179: Implement realpath() on Windows for getpath.py calculations (GH-113033)
Steve Dower [Wed, 13 Dec 2023 23:41:43 +0000 (23:41 +0000)] 
gh-86179: Implement realpath() on Windows for getpath.py calculations (GH-113033)

5 months agoMove optimizer/executor tests to new file test_capi/test_opt.py (#113072)
Guido van Rossum [Wed, 13 Dec 2023 21:49:29 +0000 (13:49 -0800)] 
Move optimizer/executor tests to new file test_capi/test_opt.py (#113072)

5 months agobpo-40648: Test modes that file can get with chmod() on Windows (GH-20130)
Pavol Babinčák‏ [Wed, 13 Dec 2023 20:23:13 +0000 (21:23 +0100)] 
bpo-40648: Test modes that file can get with chmod() on Windows (GH-20130)

Order of tests matter second part makes testing file writable and
possible to remove again.

5 months agogh-107959: clarify Unix-availability of `os.lchmod()` (GH-107960)
Christoph Anton Mitterer [Wed, 13 Dec 2023 19:55:31 +0000 (20:55 +0100)] 
gh-107959: clarify Unix-availability of `os.lchmod()` (GH-107960)

POSIX specifies that implementations are not required to support changing the
file mode of symbolic links, but may do so.
Consequently, `lchmod()` is not part of POSIX (but mentioned for implementations
which do support the above).

The current wording of the availability of `os.lchmod()` is rather vague and
improved to clearly tell which POSIX/Unix/BSD-like support the function in
general (those that support changing the file mode of symbolic links).
Further, some examples of major implementations are added.

Data for the BSDs taken from their online manpages.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
5 months agoDocs: Fix external link to devguide.python.org (GH-112899)
Miro Hrončok [Wed, 13 Dec 2023 19:37:13 +0000 (20:37 +0100)] 
Docs: Fix external link to devguide.python.org (GH-112899)

5 months agogh-101100: Improve docs on exception attributes (GH-113057)
Alex Waygood [Wed, 13 Dec 2023 18:59:36 +0000 (18:59 +0000)] 
gh-101100: Improve docs on exception attributes (GH-113057)

* Improve docs on exception attributes

* thanks sphinx-lint

* fix doctests

* argh, okay, give up on doctests

* Various improvements

5 months agoUse match/case in grouper() recipe (gh-113059)
Raymond Hettinger [Wed, 13 Dec 2023 18:11:52 +0000 (12:11 -0600)] 
Use match/case in grouper() recipe (gh-113059)

Use match/case in grouper() reciper

5 months agogh-76785: Fix CODEOWNERS (gh-113038)
Eric Snow [Wed, 13 Dec 2023 16:29:40 +0000 (09:29 -0700)] 
gh-76785: Fix CODEOWNERS (gh-113038)

In gh-112982 I made some changes to .github/CODEOWNERS.  Later, @ezio-melotti pointed out that some of those changes were unnecessary.

5 months agogh-110190: Fix ctypes structs with array on PPCLE64 (GH-112959)
Diego Russo [Wed, 13 Dec 2023 16:08:15 +0000 (16:08 +0000)] 
gh-110190: Fix ctypes structs with array on PPCLE64 (GH-112959)

Fix the same issue of PR #112604 on PPC64LE platform
Refactor tests to make easier to add more platfroms if needed.

5 months agogh-111650: Ensure pyconfig.h includes Py_GIL_DISABLED on Windows (GH-112778)
Steve Dower [Wed, 13 Dec 2023 15:38:45 +0000 (15:38 +0000)] 
gh-111650: Ensure pyconfig.h includes Py_GIL_DISABLED on Windows (GH-112778)

5 months agogh-112205: Support `@setter` annotation from AC (gh-112922)
Donghee Na [Wed, 13 Dec 2023 14:00:34 +0000 (14:00 +0000)] 
gh-112205: Support `@setter` annotation from AC (gh-112922)

---------

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
5 months agoFix whitespace in generated code
Mark Shannon [Wed, 13 Dec 2023 12:31:41 +0000 (12:31 +0000)] 
Fix whitespace in generated code

5 months ago[pprint]: Add docstring about `PrettyPrinter.underscore_numbers` parameter (#112963)
Sequew [Wed, 13 Dec 2023 12:04:17 +0000 (15:04 +0300)] 
[pprint]: Add docstring about `PrettyPrinter.underscore_numbers` parameter (#112963)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
5 months agogh-112962: in dis module, put cache information in the Instruction instead of creatin...
Irit Katriel [Wed, 13 Dec 2023 12:00:21 +0000 (12:00 +0000)] 
gh-112962: in dis module, put cache information in the Instruction instead of creating fake Instructions to represent it (#113016)

5 months agogh-101100: Fix Sphinx warning in references with asterisks (#113029)
Hugo van Kemenade [Wed, 13 Dec 2023 07:24:55 +0000 (09:24 +0200)] 
gh-101100: Fix Sphinx warning in references with asterisks (#113029)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
5 months agogh-101336: Add keep_alive keyword arg for asyncio create_server() (#112485)
beavailable [Wed, 13 Dec 2023 03:23:29 +0000 (11:23 +0800)] 
gh-101336: Add keep_alive keyword arg for asyncio create_server() (#112485)

5 months agogh-112622: Pass name to loop create_task method (#112623)
Jamie [Wed, 13 Dec 2023 01:26:40 +0000 (12:26 +1100)] 
gh-112622: Pass name to loop create_task method (#112623)

This affects task creation through either `asyncio.create_task()` or `TaskGroup.create_task()` -- the redundant call to `task.set_name()` is skipped. We still call `set_name()` when a task factory is involved, because the task factory call signature (unfortunately) doesn't take a `name` argument.

5 months agogh-76785: Avoid Pickled TracebackException for Propagated Subinterpreter Exceptions...
Eric Snow [Wed, 13 Dec 2023 00:31:30 +0000 (17:31 -0700)] 
gh-76785: Avoid Pickled TracebackException for Propagated Subinterpreter Exceptions (gh-113036)

We need the TracebackException of uncaught exceptions for a single purpose: the error display.  Thus we only need to pass the formatted error display between interpreters.  Passing a pickled TracebackException is overkill.

5 months agogh-112989: asyncio: Reduce overhead to connect sockets with SelectorEventLoop (#112991)
J. Nick Koston [Wed, 13 Dec 2023 00:29:21 +0000 (14:29 -1000)] 
gh-112989: asyncio: Reduce overhead to connect sockets with SelectorEventLoop (#112991)

_ensure_fd_no_transport had a KeyError in the success path

5 months agogh-112723: Call `PyThreadState_Clear()` from the correct interpreter (#112776)
Sam Gross [Wed, 13 Dec 2023 00:20:21 +0000 (19:20 -0500)] 
gh-112723: Call `PyThreadState_Clear()` from the correct interpreter (#112776)

The `PyThreadState_Clear()` function must only be called with the GIL
held and must be called from the same interpreter as the passed in
thread state. Otherwise, any Python objects on the thread state may be
destroyed using the wrong interpreter, leading to memory corruption.

This is also important for `Py_GIL_DISABLED` builds because free lists
will be associated with PyThreadStates and cleared in
`PyThreadState_Clear()`.

This fixes two places that called `PyThreadState_Clear()` from the wrong
interpreter and adds an assertion to `PyThreadState_Clear()`.

5 months agogh-76785: Show the Traceback for Uncaught Subinterpreter Exceptions (gh-113034)
Eric Snow [Wed, 13 Dec 2023 00:00:54 +0000 (17:00 -0700)] 
gh-76785: Show the Traceback for Uncaught Subinterpreter Exceptions (gh-113034)

When an exception is uncaught in Interpreter.exec_sync(), it helps to show that exception's error display if uncaught in the calling interpreter.  We do so here by generating a TracebackException in the subinterpreter and passing it between interpreters using pickle.

5 months agogh-112320: Implement on-trace confidence tracking for branches (#112321)
Guido van Rossum [Tue, 12 Dec 2023 21:43:08 +0000 (13:43 -0800)] 
gh-112320: Implement on-trace confidence tracking for branches (#112321)

We track the confidence as a scaled int.

5 months agogh-113010: Don't decrement deferred in pystats (#113032)
Michael Droettboom [Tue, 12 Dec 2023 21:17:08 +0000 (16:17 -0500)] 
gh-113010: Don't decrement deferred in pystats (#113032)

This fixes a recently introduced bug where the deferred count is being unnecessarily decremented to counteract an increment elsewhere that is no longer happening. This caused the values to flip around to "very large" 64-bit numbers.

5 months agogh-101100: Further improve docs on function attributes (#113001)
Alex Waygood [Tue, 12 Dec 2023 20:21:12 +0000 (20:21 +0000)] 
gh-101100: Further improve docs on function attributes (#113001)

5 months agoGH-108866: Guarantee forward progress in executors. (GH-113006)
Mark Shannon [Tue, 12 Dec 2023 19:02:24 +0000 (19:02 +0000)] 
GH-108866: Guarantee forward progress in executors. (GH-113006)

5 months agogh-76785: Add Interpreter.prepare_main() (gh-113021)
Eric Snow [Tue, 12 Dec 2023 18:06:06 +0000 (11:06 -0700)] 
gh-76785: Add Interpreter.prepare_main() (gh-113021)

This is one of the last pieces to get test.support.interpreters in sync with PEP 734.

5 months agogh-76785: More Fixes for test.support.interpreters (gh-113012)
Eric Snow [Tue, 12 Dec 2023 17:43:30 +0000 (10:43 -0700)] 
gh-76785: More Fixes for test.support.interpreters (gh-113012)

This brings the module (along with the associated extension modules) mostly in sync with PEP 734.  There are only a few small things to wrap up.

5 months agogh-76785: Fix test_threading on Non-Subinterpreter Builds (gh-113014)
Eric Snow [Tue, 12 Dec 2023 16:54:39 +0000 (09:54 -0700)] 
gh-76785: Fix test_threading on Non-Subinterpreter Builds (gh-113014)

gh-112982 broke test_threading on one of the s390 buildbots (Fedora Clang Installed).  Apparently ImportError is raised (rather than ModuleNotFoundError) for the name part of "from" imports.  This fixes that by catching ImportError in test_threading.py.

5 months agogh-112999: Replace the outdated "deprecated" directives with "versionchanged" (GH...
Serhiy Storchaka [Tue, 12 Dec 2023 16:31:04 +0000 (18:31 +0200)] 
gh-112999: Replace the outdated "deprecated" directives with "versionchanged" (GH-113000)

5 months agoUpdate pre-commit to fix Sphinx Lint (#113015)
Hugo van Kemenade [Tue, 12 Dec 2023 16:29:08 +0000 (18:29 +0200)] 
Update pre-commit to fix Sphinx Lint (#113015)

5 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.

5 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)

5 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)

5 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>
5 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>
5 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)

5 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

5 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

5 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)

5 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)

5 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)

5 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>
6 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

6 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.

6 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)

6 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.

6 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

6 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>
6 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
6 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)

6 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)

6 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)

6 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>
6 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>
6 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)

6 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)

6 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.

6 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)

6 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>
6 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.

6 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)

6 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.

6 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>
6 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)

6 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>
6 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.

6 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)

6 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.

6 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)

6 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.

6 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)

6 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)

6 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.

6 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)

6 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)

6 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)

6 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

6 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)

6 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)

6 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)

6 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)

6 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