]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
22 months agogh-113246: Updated bundled pip to 23.3.2 (gh-113249)
Stéphane Bidoul [Mon, 18 Dec 2023 10:21:46 +0000 (11:21 +0100)] 
gh-113246: Updated bundled pip to 23.3.2 (gh-113249)

Updated bundled pip to 23.3.2

22 months agogh-101100: Fix Sphinx warnings in library/tarfile.rst (#113237)
Hugo van Kemenade [Mon, 18 Dec 2023 06:57:45 +0000 (08:57 +0200)] 
gh-101100: Fix Sphinx warnings in library/tarfile.rst (#113237)

Fix Sphinx warnings in library/tarfile.rst

22 months agogh-113117: Support posix_spawn in subprocess.Popen with close_fds=True (#113118)
Jakub Kulík [Sun, 17 Dec 2023 21:34:57 +0000 (22:34 +0100)] 
gh-113117: Support posix_spawn in subprocess.Popen with close_fds=True (#113118)

Add support for `os.POSIX_SPAWN_CLOSEFROM` and
`posix_spawn_file_actions_addclosefrom_np` and have the `subprocess` module use
them when available.  This means `posix_spawn` can now be used in the default
`close_fds=True` situation on many platforms.

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
22 months agoDocs: Add label to grammar spec for linking from PEPs (#113235)
Hugo van Kemenade [Sun, 17 Dec 2023 19:23:14 +0000 (21:23 +0200)] 
Docs: Add label to grammar spec for linking from PEPs (#113235)

22 months agogh-113149: Improve error message when JSON has trailing comma (GH-113227)
Carson Radtke [Sun, 17 Dec 2023 18:52:26 +0000 (12:52 -0600)] 
gh-113149: Improve error message when JSON has trailing comma (GH-113227)

22 months agogh-112890: `unittest` Test Discovery page updated "`unittest` dropped the namspace...
Taylor Packard [Sun, 17 Dec 2023 11:14:21 +0000 (06:14 -0500)] 
gh-112890: `unittest` Test Discovery page updated "`unittest` dropped the namspace packages support" (GH-113195)

22 months agogh-113119 fix environment handling in subprocess.Popen when posix_spawn is used ...
Jakub Kulík [Sun, 17 Dec 2023 05:19:05 +0000 (06:19 +0100)] 
gh-113119 fix environment handling in subprocess.Popen when posix_spawn is used (#113120)

* Allow posix_spawn to inherit environment form parent environ variable.

With this change, posix_spawn call can behave similarly to execv with regards to environments when used in subprocess functions.

22 months agoIDLE: Add util and stub example comments (#113222)
Terry Jan Reedy [Sun, 17 Dec 2023 00:51:25 +0000 (19:51 -0500)] 
IDLE: Add util and stub example comments (#113222)

22 months agoGH-110109: pathlib tests: store base directory as test class attribute (#113221)
Barney Gale [Sun, 17 Dec 2023 00:07:32 +0000 (00:07 +0000)] 
GH-110109: pathlib tests: store base directory as test class attribute (#113221)

Store the test base directory as a class attribute named `base` rather than
module constants named `BASE`.

The base directory is a local file path, and therefore not ideally suited
to the pathlib ABC tests. In a future commit we'll change its value in
`test_pathlib_abc.py` such that it points to a totally fictitious path, which
will help to ensure we're not touching the local filesystem.

22 months agoGH-110109: Move tests for pathlib ABCs to new module. (#112904)
Barney Gale [Sat, 16 Dec 2023 19:04:33 +0000 (19:04 +0000)] 
GH-110109: Move tests for pathlib ABCs to new module. (#112904)

22 months agogh-113202: Add a strict option to itertools.batched() (gh-113203)
Raymond Hettinger [Sat, 16 Dec 2023 15:13:50 +0000 (09:13 -0600)] 
gh-113202: Add a strict option to itertools.batched() (gh-113203)

22 months agogh-67790: Support basic formatting for Fraction (#111320)
Mark Dickinson [Sat, 16 Dec 2023 10:58:31 +0000 (10:58 +0000)] 
gh-67790: Support basic formatting for Fraction (#111320)

PR #100161 added fancy float-style formatting for the Fraction type,
but left us in a state where basic formatting for fractions (alignment,
fill, minimum width, thousands separators) still wasn't supported.

This PR adds that support.

---------

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
22 months agogh-113046: Revise csv.reader doc (#113207)
Terry Jan Reedy [Sat, 16 Dec 2023 08:12:39 +0000 (03:12 -0500)] 
gh-113046: Revise csv.reader doc (#113207)

Clarify nature of csvfile.

22 months agogh-111964: Add _PyRWMutex a "readers-writer" lock (gh-112859)
Sam Gross [Sat, 16 Dec 2023 01:56:55 +0000 (20:56 -0500)] 
gh-111964: Add _PyRWMutex a "readers-writer" lock (gh-112859)

This adds `_PyRWMutex`, a "readers-writer" lock, which wil be used to
serialize global stop-the-world pauses with per-interpreter pauses.

22 months agoAdd reshape() recipe to demonstrate a use case for batched() and chained.from_iterabl...
Raymond Hettinger [Sat, 16 Dec 2023 00:03:44 +0000 (18:03 -0600)] 
Add reshape() recipe to demonstrate a use case for batched() and chained.from_iterable() (gh-113198)

22 months agogh-110746: Improve markup in ``tkinter.ttk.rst`` (#111236)
Akshat Khandelwal [Fri, 15 Dec 2023 20:53:16 +0000 (02:23 +0530)] 
gh-110746: Improve markup in ``tkinter.ttk.rst`` (#111236)

* gh-110746: Improve markup in tkinter.ttk.rst

* gh-110746: Improve markup in tkinter.ttk.rst

* 📜🤖 Added by blurb_it.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
22 months agoGH-112383: Fix test_loop_quicken when an executor is installed (GH-113153)
Brandt Bucher [Fri, 15 Dec 2023 17:27:57 +0000 (09:27 -0800)] 
GH-112383: Fix test_loop_quicken when an executor is installed (GH-113153)

22 months agogh-101100: Fix various Sphinx warnings for dunder references in the `library/` direct...
Alex Waygood [Fri, 15 Dec 2023 17:15:34 +0000 (17:15 +0000)] 
gh-101100: Fix various Sphinx warnings for dunder references in the `library/` directory (#113163)

22 months agogh-101100: Fix Sphinx nitpicks in `library/numbers.rst` (#113162)
Alex Waygood [Fri, 15 Dec 2023 17:05:12 +0000 (17:05 +0000)] 
gh-101100: Fix Sphinx nitpicks in `library/numbers.rst` (#113162)

22 months agogh-113172: Fix compiler warnings in Modules/_xxinterpqueuesmodule.c (GH-113173)
Serhiy Storchaka [Fri, 15 Dec 2023 15:36:25 +0000 (17:36 +0200)] 
gh-113172: Fix compiler warnings in Modules/_xxinterpqueuesmodule.c (GH-113173)

Fix compiler waarnings in Modules/_xxinterpqueuesmodule.c

22 months ago[CVE-2023-27043] gh-102988: Reject malformed addresses in email.parseaddr() (#111116)
Victor Stinner [Fri, 15 Dec 2023 15:10:40 +0000 (16:10 +0100)] 
[CVE-2023-27043] gh-102988: Reject malformed addresses in email.parseaddr() (#111116)

Detect email address parsing errors and return empty tuple to
indicate the parsing error (old API). Add an optional 'strict'
parameter to getaddresses() and parseaddr() functions. Patch by
Thomas Dwyer.

Co-Authored-By: Thomas Dwyer <github@tomd.tel>
22 months agogh-113009: Fix multiprocessing Process.terminate() on Windows (#113128)
Victor Stinner [Fri, 15 Dec 2023 14:57:49 +0000 (15:57 +0100)] 
gh-113009: Fix multiprocessing Process.terminate() on Windows (#113128)

On Windows, Process.terminate() no longer sets the returncode
attribute to always call WaitForSingleObject() in Process.wait().
Previously, sometimes the process was still running after
TerminateProcess() even if GetExitCodeProcess() is not STILL_ACTIVE.

22 months agogh-112278: Add retry in WMI tests in case of slow initialization (GH-113154)
AN Long [Fri, 15 Dec 2023 13:42:37 +0000 (21:42 +0800)] 
gh-112278: Add retry in WMI tests in case of slow initialization (GH-113154)

22 months agogh-61648: Detect line numbers of properties in doctests (GH-113161)
Serhiy Storchaka [Fri, 15 Dec 2023 13:24:30 +0000 (15:24 +0200)] 
gh-61648: Detect line numbers of properties in doctests (GH-113161)

22 months agoGH-111485: Mark some instructions as `TIER_ONE_ONLY` (GH-113155)
Brandt Bucher [Fri, 15 Dec 2023 13:03:17 +0000 (05:03 -0800)] 
GH-111485: Mark some instructions as `TIER_ONE_ONLY` (GH-113155)

22 months agogh-112720: Move dis's cache output code to the Formatter, labels lookup to the arg_re...
Irit Katriel [Fri, 15 Dec 2023 12:28:22 +0000 (12:28 +0000)] 
gh-112720: Move dis's cache output code to the Formatter, labels lookup to the arg_resolver. Reduce the number of parameters passed around. (#113108)

22 months agogh-101100: Fix Sphinx nitpicks in `library/rlcompleter.rst` (#113125)
Alex Waygood [Fri, 15 Dec 2023 08:57:23 +0000 (08:57 +0000)] 
gh-101100: Fix Sphinx nitpicks in `library/rlcompleter.rst` (#113125)

22 months agogh-112535: Update _Py_ThreadId() to support RISC-V (gh-113084)
Furkan Onder [Thu, 14 Dec 2023 23:42:33 +0000 (02:42 +0300)] 
gh-112535: Update _Py_ThreadId() to support RISC-V (gh-113084)

Update _Py_ThreadId() to support RISC-V

22 months agoOptimize unique_justseen() recipe for a common case. (gh-113147)
Raymond Hettinger [Thu, 14 Dec 2023 23:27:39 +0000 (17:27 -0600)] 
Optimize unique_justseen() recipe for a common case. (gh-113147)

22 months agogh-101100: Cleanup `mailbox` docs (#113124)
Alex Waygood [Thu, 14 Dec 2023 21:10:26 +0000 (21:10 +0000)] 
gh-101100: Cleanup `mailbox` docs (#113124)

22 months agogh-101100: Fix Sphinx warnings in `whatsnew/2.3.rst` (#112373)
Hugo van Kemenade [Thu, 14 Dec 2023 20:48:36 +0000 (22:48 +0200)] 
gh-101100: Fix Sphinx warnings in `whatsnew/2.3.rst` (#112373)

22 months agoRemove itertool recipe with low pedagogical value (gh-113138)
Raymond Hettinger [Thu, 14 Dec 2023 20:36:40 +0000 (14:36 -0600)] 
Remove itertool recipe with low pedagogical value (gh-113138)

22 months agogh-101100: Fix Sphinx nitpicks in `library/collections.abc.rst` (#113116)
Alex Waygood [Thu, 14 Dec 2023 19:25:55 +0000 (19:25 +0000)] 
gh-101100: Fix Sphinx nitpicks in `library/collections.abc.rst` (#113116)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

22 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

22 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

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

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

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

22 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>
22 months agoFix whitespace in generated code
Mark Shannon [Wed, 13 Dec 2023 12:31:41 +0000 (12:31 +0000)] 
Fix whitespace in generated code

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

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

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

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

22 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

22 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()`.

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

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

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

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

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

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

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

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

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

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

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)

23 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

23 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

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

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

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

23 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>
23 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

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

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

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

23 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

23 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>
23 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