]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-110391: socket NetworkConnectionAttributesTest always declare cli (#110401)
Victor Stinner [Thu, 5 Oct 2023 16:31:02 +0000 (18:31 +0200)] 
gh-110391: socket NetworkConnectionAttributesTest always declare cli (#110401)

NetworkConnectionAttributesTest of test_socket now always declare the
'cli' attribute, so clientTearDown() cannot fail with AttributeError.

2 years agogh-109549: Add new states to PyThreadState to support PEP 703 (gh-109915)
Sam Gross [Thu, 5 Oct 2023 15:46:33 +0000 (15:46 +0000)] 
gh-109549: Add new states to PyThreadState to support PEP 703 (gh-109915)

This adds a new field 'state' to PyThreadState that can take on one of three values: _Py_THREAD_ATTACHED, _Py_THREAD_DETACHED, or _Py_THREAD_GC.  The "attached" and "detached" states correspond closely to acquiring and releasing the GIL.  The "gc" state is current unused, but will be used to implement stop-the-world GC for --disable-gil builds in the near future.

2 years agogh-109329: Add stat for "trace too short" (GH-110402)
Michael Droettboom [Thu, 5 Oct 2023 15:12:06 +0000 (11:12 -0400)] 
gh-109329: Add stat for "trace too short" (GH-110402)

2 years agogh-110393: Remove watchdog with hardcoded timeout (#110400)
Victor Stinner [Thu, 5 Oct 2023 15:02:48 +0000 (17:02 +0200)] 
gh-110393: Remove watchdog with hardcoded timeout (#110400)

test_builtin and test_socketserver no longer use signal.alarm() to
implement a watchdog with a hardcoded timeout (2 and 60 seconds).
Python test runner regrtest has two watchdogs: faulthandler and
timeout on running worker processes. Tests using short hardcoded
timeout can fail on slowest buildbots just because the timeout is too
short.

2 years agogh-82367: Use `FindFirstFile` Win32 API in `ntpath.realpath()` (GH-110298)
박문식 [Thu, 5 Oct 2023 14:49:07 +0000 (23:49 +0900)] 
gh-82367: Use `FindFirstFile` Win32 API in `ntpath.realpath()` (GH-110298)

* Use `FindFirstFile` Win32 API to fix a bug where `ntpath.realpath()`
breaks out of traversing a series of paths where a (handled)
`ERROR_ACCESS_DENIED` or `ERROR_SHARING_VIOLATION` occurs.
* Update docs to reflect that `ntpath.realpath()` eliminates MS-DOS
style names.

2 years agogh-110309: Prune empty constant in format specs (#110320)
sunmy2019 [Thu, 5 Oct 2023 14:08:42 +0000 (22:08 +0800)] 
gh-110309: Prune empty constant in format specs (#110320)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 years agogh-110259: Fix f-strings with multiline expressions and format specs (#110271)
Pablo Galindo Salgado [Thu, 5 Oct 2023 13:26:44 +0000 (14:26 +0100)] 
gh-110259: Fix f-strings with multiline expressions and format specs (#110271)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2 years agogh-110367: Fix regrtest test_worker_output_on_failure() on ASAN build (#110387)
Victor Stinner [Thu, 5 Oct 2023 12:42:36 +0000 (14:42 +0200)] 
gh-110367: Fix regrtest test_worker_output_on_failure() on ASAN build (#110387)

Set ASAN_OPTIONS="handle_segv=0" env var to run the test.

2 years agogh-110365: Fix error overwrite in `termios.tcsetattr` (#110366)
Nikita Sobolev [Thu, 5 Oct 2023 11:02:52 +0000 (14:02 +0300)] 
gh-110365: Fix error overwrite in `termios.tcsetattr` (#110366)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2 years agogh-110367: Enhance regrtest -jN --verbose3 (#110368)
Victor Stinner [Thu, 5 Oct 2023 06:24:43 +0000 (08:24 +0200)] 
gh-110367: Enhance regrtest -jN --verbose3 (#110368)

When using worker processes (-jN) with --verbose3 option, regrtest
can now display the worker output even if a worker process does
crash.  Previously, sys.stdout and sys.stderr were replaced and so
the worker output was lost on a crash.

2 years agoRemove duplicate word. (#110376)
Benjamin Peterson [Thu, 5 Oct 2023 04:18:17 +0000 (15:18 +1100)] 
Remove duplicate word. (#110376)

2 years agogh-88402: Add new sysconfig variables on Windows (GH-110049) 110252/head
Sam Gross [Wed, 4 Oct 2023 22:50:29 +0000 (22:50 +0000)] 
gh-88402: Add new sysconfig variables on Windows (GH-110049)

Co-authored-by: Filipe Laíns <filipe.lains@gmail.com>
2 years agogh-110310: Add a Per-Interpreter XID Registry for Heap Types (gh-110311)
Eric Snow [Wed, 4 Oct 2023 22:35:27 +0000 (16:35 -0600)] 
gh-110310: Add a Per-Interpreter XID Registry for Heap Types (gh-110311)

We do the following:

* add a per-interpreter XID registry (PyInterpreterState.xidregistry)
* put heap types there (keep static types in _PyRuntimeState.xidregistry)
* clear the registries during interpreter/runtime finalization
* avoid duplicate entries in the registry (when _PyCrossInterpreterData_RegisterClass() is called more than once for a type)
* use Py_TYPE() instead of PyObject_Type() in _PyCrossInterpreterData_Lookup()

The per-interpreter registry helps preserve isolation between interpreters.  This is important when heap types are registered, which is something we haven't been doing yet but I will likely do soon.

2 years agoGH-109329: Add tier 2 stats (GH-109913)
Michael Droettboom [Wed, 4 Oct 2023 21:52:28 +0000 (17:52 -0400)] 
GH-109329: Add tier 2 stats (GH-109913)

2 years agoAdd back bltin-boolean-values ref tag (#110371)
P. L. Lim [Wed, 4 Oct 2023 19:56:11 +0000 (15:56 -0400)] 
Add back bltin-boolean-values ref tag (#110371)

To avoid breaking downstream intersphinx via numpydoc

2 years agogh-76785: Print the Traceback from Interpreter.run() (gh-110322)
Eric Snow [Wed, 4 Oct 2023 17:57:03 +0000 (11:57 -0600)] 
gh-76785: Print the Traceback from Interpreter.run() (gh-110322)

This is a temporary solution.  The full fix may involve serializing the traceback in some form.

(FYI, I merged this yesterday and the reverted it due to buildbot failures.  See gh-110248.)

2 years agogh-110222: Add support of PyStructSequence in copy.replace() (GH-110223)
Xuehai Pan [Wed, 4 Oct 2023 16:47:41 +0000 (00:47 +0800)] 
gh-110222: Add support of PyStructSequence in copy.replace() (GH-110223)

2 years agogh-110235: Raise TypeError for duplicate/unknown fields in PyStructSequence construct...
Xuehai Pan [Wed, 4 Oct 2023 16:44:17 +0000 (00:44 +0800)] 
gh-110235: Raise TypeError for duplicate/unknown fields in PyStructSequence constructor (GH-110258)

2 years agoGH-109369: Merge all eval-breaker flags and monitoring version into one word. (GH...
Mark Shannon [Wed, 4 Oct 2023 15:09:48 +0000 (16:09 +0100)] 
GH-109369: Merge all eval-breaker flags and monitoring version into one word. (GH-109846)

2 years agogh-104909: Split more LOAD_ATTR specializations (GH-110317)
Guido van Rossum [Wed, 4 Oct 2023 15:08:02 +0000 (08:08 -0700)] 
gh-104909: Split more LOAD_ATTR specializations (GH-110317)

* Split LOAD_ATTR_MODULE

* Split LOAD_ATTR_WITH_HINT

* Split _GUARD_TYPE_VERSION out of the latter

* Split LOAD_ATTR_CLASS

* Split LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES

* Fix indent of DEOPT_IF in macros

* Split LOAD_ATTR_METHOD_LAZY_DICT

* Split LOAD_ATTR_NONDESCRIPTOR_NO_DICT

* Fix omission of _CHECK_ATTR_METHOD_LAZY_DICT

2 years agoLint: Remove files that no longer fail to parse or with F811 (#110356)
Hugo van Kemenade [Wed, 4 Oct 2023 13:11:32 +0000 (07:11 -0600)] 
Lint: Remove files that no longer fail to parse or with F811 (#110356)

2 years agogh-110260: Check for PyList_SetItem() errors in termios module (GH-110261)
Nikita Sobolev [Wed, 4 Oct 2023 12:42:17 +0000 (15:42 +0300)] 
gh-110260: Check for PyList_SetItem() errors in termios module (GH-110261)

2 years agogh-109151: Enable readline in the sqlite3 CLI (GH-109152)
Serhiy Storchaka [Wed, 4 Oct 2023 11:16:44 +0000 (14:16 +0300)] 
gh-109151: Enable readline in the sqlite3 CLI (GH-109152)

2 years agogh-110332: Remove mentions of `random.WichmannHill` from `test_zlib` (#110334)
Nikita Sobolev [Wed, 4 Oct 2023 10:51:45 +0000 (13:51 +0300)] 
gh-110332: Remove mentions of `random.WichmannHill` from `test_zlib` (#110334)

2 years agogh-109276: regrtest: shorter list of resources (#110326)
Victor Stinner [Wed, 4 Oct 2023 09:39:50 +0000 (11:39 +0200)] 
gh-109276: regrtest: shorter list of resources (#110326)

2 years agogh-110335: asyncio test_unix_events cleans multiprocessing (#110336)
Victor Stinner [Wed, 4 Oct 2023 09:19:08 +0000 (11:19 +0200)] 
gh-110335: asyncio test_unix_events cleans multiprocessing (#110336)

test_unix_events tests using the multiprocessing module now call
multiprocessing.util._cleanup_tests().

2 years agogh-110166: Fix gdb CFunctionFullTests on ppc64le clang build (#110331)
Victor Stinner [Wed, 4 Oct 2023 08:57:35 +0000 (10:57 +0200)] 
gh-110166: Fix gdb CFunctionFullTests on ppc64le clang build (#110331)

CFunctionFullTests now also runs "bt" command before "py-bt-full",
similar to CFunctionTests which also runs "bt" command before
"py-bt". So test_gdb can skip the test if patterns like "?? ()" are
found in the gdb output.

2 years agogh-110171: `libregrtest` always sets `random.seed` (#110172)
Nikita Sobolev [Wed, 4 Oct 2023 06:42:12 +0000 (09:42 +0300)] 
gh-110171: `libregrtest` always sets `random.seed`  (#110172)

2 years agogh-110273: dataclasses.replace() now raise TypeError for all invalid arguments (GH...
Serhiy Storchaka [Wed, 4 Oct 2023 06:20:14 +0000 (09:20 +0300)] 
gh-110273: dataclasses.replace() now raise TypeError for all invalid arguments (GH-110274)

dataclasses.replace() now raises TypeError instead of ValueError if
specify keyword argument for a field declared with init=False or miss keyword
argument for required InitVar field.

2 years agogh-109653: Defer importing `warnings` in several modules (#110286)
Alex Waygood [Wed, 4 Oct 2023 05:09:43 +0000 (06:09 +0100)] 
gh-109653: Defer importing `warnings` in several modules (#110286)

2 years agogh-85984: Document change in return type of tty functions (#110028)
Jelle Zijlstra [Wed, 4 Oct 2023 03:46:38 +0000 (20:46 -0700)] 
gh-85984: Document change in return type of tty functions (#110028)

2 years agogh-110300: Fix Refleaks in test_interpreters and test__xxinterpchannels (gh-110318)
Eric Snow [Wed, 4 Oct 2023 00:36:50 +0000 (18:36 -0600)] 
gh-110300: Fix Refleaks in test_interpreters and test__xxinterpchannels (gh-110318)

2 years agogh-109979: Unify _GUARD_TYPE_VERSION{,_STORE} (#110301)
Guido van Rossum [Tue, 3 Oct 2023 22:37:21 +0000 (15:37 -0700)] 
gh-109979: Unify _GUARD_TYPE_VERSION{,_STORE} (#110301)

Now the target for `DEOPT_IF()` is auto-filled,
we don't need a separate `_GUARD_TYPE_VERSION_STORE` uop.

2 years agogh-109917: Fix test instability in test_concurrent_futures (#110306)
elfstrom [Tue, 3 Oct 2023 21:59:49 +0000 (23:59 +0200)] 
gh-109917: Fix test instability in test_concurrent_futures (#110306)

The test had an instability issue due to the ordering of the dummy
queue operation and the real wakeup pipe operations. Both primitives
are thread safe but not done atomically as a single update and may
interleave arbitrarily. With the old order of operations this can lead
to an incorrect state where the dummy queue is full but the wakeup
pipe is empty. By swapping the order in clear() I think this can no
longer happen in any possible operation interleaving (famous last
words).

2 years agoRevert "gh-76785: Print the Traceback from Interpreter.run() (gh-110248)" (gh-110314)
Eric Snow [Tue, 3 Oct 2023 21:18:25 +0000 (15:18 -0600)] 
Revert "gh-76785: Print the Traceback from Interpreter.run() (gh-110248)" (gh-110314)

This reverts commit 6bc889aedc11cc8e0b9f57948a3d528ad2685497.

That commit is causing some buildbot failures.

2 years agogh-76785: Print the Traceback from Interpreter.run() (gh-110248)
Eric Snow [Tue, 3 Oct 2023 20:41:02 +0000 (14:41 -0600)] 
gh-76785: Print the Traceback from Interpreter.run() (gh-110248)

This is a temporary fix. The full fix may involve serializing the traceback in some form.

2 years agoDocs: Avoid the deprecated ``.. cmdoption::`` directive (#110292)
Adam Turner [Tue, 3 Oct 2023 17:38:12 +0000 (18:38 +0100)] 
Docs: Avoid the deprecated ``.. cmdoption::`` directive (#110292)

2 years agogh-109979: Auto-generate the target for DEOPT_IF() (#110193)
Guido van Rossum [Tue, 3 Oct 2023 17:13:50 +0000 (10:13 -0700)] 
gh-109979: Auto-generate the target for DEOPT_IF() (#110193)

In Python/bytecodes.c, you now write
```
    DEOPT_IF(condition);
```
The code generator expands this to
```
    DEOPT_IF(condition, opcode);
```
where `opcode` is the name of the unspecialized instruction.
This works inside macro expansions too.

**CAVEAT:** The entire `DEOPT_IF(condition)` statement must be on a single line.
If it isn't, the substitution will fail; an error will be printed by the code generator
and the C compiler will report some errors.

2 years agogh-108867: Add PyThreadState_GetUnchecked() function (#108870)
Victor Stinner [Tue, 3 Oct 2023 16:53:51 +0000 (18:53 +0200)] 
gh-108867: Add PyThreadState_GetUnchecked() function (#108870)

Add PyThreadState_GetUnchecked() function: similar to
PyThreadState_Get(), but don't issue a fatal error if it is NULL. The
caller is responsible to check if the result is NULL. Previously,
this function was private and known as _PyThreadState_UncheckedGet().

2 years agogh-110276: No longer ignore PROFILE_TASK failure silently (#110295)
Victor Stinner [Tue, 3 Oct 2023 16:43:23 +0000 (18:43 +0200)] 
gh-110276: No longer ignore PROFILE_TASK failure silently (#110295)

2 years agogh-107073: Mention pythoncapi-compat for PyObject_VisitManagedDict() (#110291)
Victor Stinner [Tue, 3 Oct 2023 15:50:10 +0000 (17:50 +0200)] 
gh-107073: Mention pythoncapi-compat for PyObject_VisitManagedDict() (#110291)

2 years agogh-109860: Use a New Thread State When Switching Interpreters, When Necessary (gh...
Eric Snow [Tue, 3 Oct 2023 15:20:48 +0000 (09:20 -0600)] 
gh-109860: Use a New Thread State When Switching Interpreters, When Necessary (gh-110245)

In a few places we switch to another interpreter without knowing if it has a thread state associated with the current thread.  For the main interpreter there wasn't much of a problem, but for subinterpreters we were *mostly* okay re-using the tstate created with the interpreter (located via PyInterpreterState_ThreadHead()).  There was a good chance that tstate wasn't actually in use by another thread.

However, there are no guarantees of that.  Furthermore, re-using an already used tstate is currently fragile.  To address this, now we create a new thread state in each of those places and use it.

One consequence of this change is that PyInterpreterState_ThreadHead() may not return NULL (though that won't happen for the main interpreter).

2 years agoEnhanced sqlite3 connection context management documentation with contextlib.closing...
Lincoln [Tue, 3 Oct 2023 14:32:43 +0000 (17:32 +0300)] 
Enhanced sqlite3 connection context management documentation with contextlib.closing gh-109234 (#109322)

* Enhanced sqlite3 connection context management documentation with contextlib.closing

* 📜🤖 Added by blurb_it.

* Fixed gitignore spelling error from nitignore to gitignore

* Renamed .gitignore to .nitignore

* Added generated doctests

* Deleted sqlite3 generated files

* Removed white-space changes

* Removed News entry from the doc

* Expanded a note that context manager can be used for connection management using contextlib.closing

* Removed repeated contextlib.closing code snippet

* Expanded the note around usage of context manageer for sqlite3 connection management

* Deleted extra white-spaces

* Deleted extra white-space

* re-arranged context manager wording

* Re-arranged word layout on how to use context manager

* Fix whitespace errors

* Remove unneeded change in .gitignore

* Added suggested changes

* Added suggested change redirecting to the contextlib.closing implementation

* Added closing keyword

* Removed line 2473

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2 years agogh-110267: Add tests for pickling and copying PyStructSequence objects (GH-110272)
Xuehai Pan [Tue, 3 Oct 2023 14:09:49 +0000 (22:09 +0800)] 
gh-110267: Add tests for pickling and copying PyStructSequence objects (GH-110272)

2 years agoBump various dependencies in `Doc/requirements-oldest-sphinx.txt` (#110278)
Alex Waygood [Tue, 3 Oct 2023 13:10:03 +0000 (14:10 +0100)] 
Bump various dependencies in `Doc/requirements-oldest-sphinx.txt` (#110278)

This resolves a Dependabot security alert on the repository for urllib3==2.0.4.

2 years agogh-110276: Run `test_str`, not `test_unicode`, as part of the PGO build (#110277)
Alex Waygood [Tue, 3 Oct 2023 12:54:21 +0000 (13:54 +0100)] 
gh-110276: Run `test_str`, not `test_unicode`, as part of the PGO build (#110277)

`test_unicode` does not exist

2 years agogh-109956: Also test typing.NamedTuple with copy.replace() (GH-109957)
Nikita Sobolev [Tue, 3 Oct 2023 11:13:13 +0000 (14:13 +0300)] 
gh-109956: Also test typing.NamedTuple with copy.replace() (GH-109957)

2 years agoFix typo in py312 whatsnew: add missing closing paren (#110255)
Lele Gaifax [Tue, 3 Oct 2023 06:10:16 +0000 (08:10 +0200)] 
Fix typo in py312 whatsnew: add missing closing paren (#110255)

2 years agoRemove unused Misc/requirements-test.txt (#110240)
Hugo van Kemenade [Tue, 3 Oct 2023 05:01:50 +0000 (23:01 -0600)] 
Remove unused Misc/requirements-test.txt (#110240)

2 years agoAdd --inline-caches flag to dis command line (#110249)
Guido van Rossum [Tue, 3 Oct 2023 00:49:34 +0000 (17:49 -0700)] 
Add --inline-caches flag to dis command line (#110249)

2 years agogh-109653: Reduce the import time of `random` by 60% (#110221)
Alex Waygood [Mon, 2 Oct 2023 22:56:31 +0000 (23:56 +0100)] 
gh-109653: Reduce the import time of `random` by 60% (#110221)

2 years agogh-110241: Add missing error check to `record_eval` in `_testinternalcapi` (#110242)
Nikita Sobolev [Mon, 2 Oct 2023 21:19:32 +0000 (00:19 +0300)] 
gh-110241: Add missing error check to `record_eval` in `_testinternalcapi` (#110242)

2 years agogh-76785: Module-level Fixes for test.support.interpreters (gh-110236)
Eric Snow [Mon, 2 Oct 2023 20:47:41 +0000 (14:47 -0600)] 
gh-76785: Module-level Fixes for test.support.interpreters (gh-110236)

* add RecvChannel.close() and SendChannel.close()
* make RecvChannel and SendChannel shareable
* expose ChannelEmptyError and ChannelNotEmptyError

2 years agoEnable ruff on `Lib/test/test_typing.py` (#110179)
Alex Waygood [Mon, 2 Oct 2023 20:13:48 +0000 (21:13 +0100)] 
Enable ruff on `Lib/test/test_typing.py` (#110179)

2 years agogh-105716: Support Background Threads in Subinterpreters Consistently (gh-109921)
Eric Snow [Mon, 2 Oct 2023 20:12:12 +0000 (14:12 -0600)] 
gh-105716: Support Background Threads in Subinterpreters Consistently (gh-109921)

The existence of background threads running on a subinterpreter was preventing interpreters from getting properly destroyed, as well as impacting the ability to run the interpreter again. It also affected how we wait for non-daemon threads to finish.

We add PyInterpreterState.threads.main, with some internal C-API functions.

2 years agogh-109853: Fix sys.path[0] For Subinterpreters (gh-109994)
Eric Snow [Mon, 2 Oct 2023 19:59:05 +0000 (13:59 -0600)] 
gh-109853: Fix sys.path[0] For Subinterpreters (gh-109994)

This change makes sure sys.path[0] is set properly for subinterpreters. Before, it wasn't getting set at all. This PR does not address the broader concerns from gh-109853.

2 years agogh-107073: Make PyObject_VisitManagedDict() public (#108763)
Victor Stinner [Mon, 2 Oct 2023 17:24:08 +0000 (19:24 +0200)] 
gh-107073: Make PyObject_VisitManagedDict() public (#108763)

Make PyObject_VisitManagedDict() and PyObject_ClearManagedDict()
functions public in Python 3.13 C API.

* Rename _PyObject_VisitManagedDict() to PyObject_VisitManagedDict().
* Rename _PyObject_ClearManagedDict() to PyObject_ClearManagedDict().
* Document these functions.

2 years agogh-108494: Document how to add a project in PCbuild/readme.txt (#110077)
Victor Stinner [Mon, 2 Oct 2023 16:53:38 +0000 (18:53 +0200)] 
gh-108494: Document how to add a project in PCbuild/readme.txt (#110077)

Add _testclinic_limited to Tools/msi/test/test_files.wxs.

2 years agogh-110014: Remove PY_TIMEOUT_MAX from limited C API (#110217)
Victor Stinner [Mon, 2 Oct 2023 16:07:56 +0000 (18:07 +0200)] 
gh-110014: Remove PY_TIMEOUT_MAX from limited C API (#110217)

If the timeout is greater than PY_TIMEOUT_MAX,
PyThread_acquire_lock_timed() uses a timeout of PY_TIMEOUT_MAX
microseconds, which is around 280.6 years. This case is unlikely and
limiting a timeout to 280.6 years sounds like a reasonable trade-off.

The constant PY_TIMEOUT_MAX is not used in PyPI top 5,000 projects.

2 years agogh-110178: Use fewer weakrefs in test_typing.py (#110194)
Jelle Zijlstra [Mon, 2 Oct 2023 15:03:53 +0000 (08:03 -0700)] 
gh-110178: Use fewer weakrefs in test_typing.py (#110194)

Confirmed that without the C changes from #108517, this test still segfaults with only 10 weakrefs.

2 years ago3.12 What's New: Remove duplicate "up to" (#110219)
numbermaniac [Mon, 2 Oct 2023 13:13:44 +0000 (00:13 +1100)] 
3.12 What's New: Remove duplicate "up to" (#110219)

2 years agogh-83180: Made launcher treat shebang 'python' tags as low priority so that active...
Steve Dower [Mon, 2 Oct 2023 12:22:55 +0000 (13:22 +0100)] 
gh-83180: Made launcher treat shebang 'python' tags as low priority so that active virtual environments are preferred (GH-108101)

2 years agoGH-109190: Announce final release in What's New in Python 3.12 (#110117)
Adam Turner [Mon, 2 Oct 2023 11:15:58 +0000 (12:15 +0100)] 
GH-109190: Announce final release in What's New in Python 3.12 (#110117)

Prepare What's New in Python 3.12 for final release

2 years agogh-108963: using random to generate unique string in sys.intern test (#109491)
AN Long [Mon, 2 Oct 2023 11:07:56 +0000 (19:07 +0800)] 
gh-108963: using random to generate unique string in sys.intern test (#109491)

2 years agoGH-92584: Move installation schemes overview to sysconfig docs (#108018)
Adam Turner [Mon, 2 Oct 2023 10:40:03 +0000 (11:40 +0100)] 
GH-92584: Move installation schemes overview to sysconfig docs (#108018)

* Add new installation path functions subsection

* Add content from install/index to sysconfig

* Fix table

* Update note about installers

* Clean up the list of schemes, remove references to Distutils

2 years agoDocs: bump Pygments to fix contrast ratios to meet WCAG AA guidelines (#110208)
Hugo van Kemenade [Mon, 2 Oct 2023 10:31:23 +0000 (04:31 -0600)] 
Docs: bump Pygments to fix contrast ratios to meet WCAG AA guidelines (#110208)

2 years agogh-109590: Update shutil.which on Windows to prefer a PATHEXT extension on executable...
Charles Machalow [Mon, 2 Oct 2023 08:27:30 +0000 (01:27 -0700)] 
gh-109590: Update shutil.which on Windows to prefer a PATHEXT extension on executable files (GH-109995)

The default arguments for shutil.which() request an executable file, but extensionless files are not executable on Windows and should be ignored.

2 years agofix misaligned versionchanged blocks in sqlite3 docs (GH-110191)
Ned Batchelder [Mon, 2 Oct 2023 03:34:09 +0000 (23:34 -0400)] 
fix misaligned versionchanged blocks in sqlite3 docs (GH-110191)

2 years agogh-110164: regrtest disables random if SOURCE_DATE_EPOCH (#110168)
Victor Stinner [Sun, 1 Oct 2023 20:41:03 +0000 (22:41 +0200)] 
gh-110164: regrtest disables random if SOURCE_DATE_EPOCH (#110168)

If the SOURCE_DATE_EPOCH environment variable is defined, regrtest
now disables randomization of tests.

2 years agogh-110138: Improve grammar in idiomatic usage of ``__main__.py`` (#110142)
Quentin Agren [Sun, 1 Oct 2023 18:32:43 +0000 (14:32 -0400)] 
gh-110138: Improve grammar in idiomatic usage of ``__main__.py`` (#110142)

2 years agogh-101100: Fix sphinx warnings in `library/site.rst` (#110144)
Nikita Sobolev [Sun, 1 Oct 2023 17:18:19 +0000 (20:18 +0300)] 
gh-101100: Fix sphinx warnings in `library/site.rst` (#110144)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agobuild(deps): bump hypothesis from 6.84.0 to 6.87.1 in /Tools (#110174)
dependabot[bot] [Sun, 1 Oct 2023 16:25:29 +0000 (17:25 +0100)] 
build(deps): bump hypothesis from 6.84.0 to 6.87.1 in /Tools (#110174)

Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.84.0 to 6.87.1.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.84.0...hypothesis-python-6.87.1)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agogh-110180: Remove unused `_PickleUsingNameMixin` class from `typing` (#110181)
Alex Waygood [Sun, 1 Oct 2023 15:28:02 +0000 (16:28 +0100)] 
gh-110180: Remove unused `_PickleUsingNameMixin` class from `typing` (#110181)

2 years agoGH-107465: Add `pathlib.Path.from_uri()` classmethod. (#107640)
Barney Gale [Sun, 1 Oct 2023 15:14:02 +0000 (16:14 +0100)] 
GH-107465: Add `pathlib.Path.from_uri()` classmethod. (#107640)

This method supports file URIs (including variants) as described in RFC 8089, such as URIs generated by `pathlib.Path.as_uri()` and `urllib.request.pathname2url()`.

The method is added to `Path` rather than `PurePath` because it uses `os.fsdecode()`, and so its results vary from system to system. I intend to deprecate `PurePath.as_uri()` and move it to `Path` for the same reason.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2 years agogh-110160: Fix flaky `test_find_periodic_pattern` in `string_tests` (#110170)
Nikita Sobolev [Sun, 1 Oct 2023 14:20:01 +0000 (17:20 +0300)] 
gh-110160: Fix flaky `test_find_periodic_pattern` in `string_tests` (#110170)

2 years agoPEG generator: bump types-setuptools from 68.1.0.1 to 68.2.0.0 (#110175)
dependabot[bot] [Sun, 1 Oct 2023 11:38:46 +0000 (12:38 +0100)] 
PEG generator: bump types-setuptools from 68.1.0.1 to 68.2.0.0 (#110175)

build(deps-dev): bump types-setuptools in /Tools

Bumps [types-setuptools](https://github.com/python/typeshed) from 68.1.0.1 to 68.2.0.0.
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-setuptools
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agogh-110150: Fix base case handling in quantiles() (gh-110151)
Raymond Hettinger [Sun, 1 Oct 2023 04:35:54 +0000 (23:35 -0500)] 
gh-110150: Fix base case handling in quantiles() (gh-110151)

2 years agogh-109649: Use os.process_cpu_count() (#110165)
Victor Stinner [Sun, 1 Oct 2023 01:14:57 +0000 (03:14 +0200)] 
gh-109649: Use os.process_cpu_count() (#110165)

Replace os.cpu_count() with os.process_cpu_count() in modules:

* compileall
* concurrent.futures
* multiprocessing

Replace os.cpu_count() with os.process_cpu_count() in programs:

* _decimal deccheck.py test
* freeze.py
* multissltests.py
* python -m test (regrtest)
* wasm_build.py

Other changes:

* test.pythoninfo logs os.process_cpu_count().
* regrtest gets os.process_cpu_count() / os.cpu_count() in headers.

2 years agogh-110152: regrtest handles cross compilation and HOSTRUNNER (#110156)
Victor Stinner [Sat, 30 Sep 2023 22:37:23 +0000 (00:37 +0200)] 
gh-110152: regrtest handles cross compilation and HOSTRUNNER (#110156)

* _add_python_opts() now handles cross compilation and HOSTRUNNER.
* display_header() now tells if Python is cross-compiled, display
  HOSTRUNNER, and get the host platform.
* Remove Tools/scripts/run_tests.py script.
* Remove "make hostrunnertest": use "make buildbottest"
  or "make test" instead.

2 years agogh-110014: Fix bootstrap_hash.c: remove debug code (#110161)
Victor Stinner [Sat, 30 Sep 2023 22:21:20 +0000 (00:21 +0200)] 
gh-110014: Fix bootstrap_hash.c: remove debug code (#110161)

Oops, I commited debug code by mistake, sorry about that.

2 years agogh-109649: Add os.process_cpu_count() function (#109907)
Victor Stinner [Sat, 30 Sep 2023 22:12:51 +0000 (00:12 +0200)] 
gh-109649: Add os.process_cpu_count() function (#109907)

* Refactor os_sched_getaffinity_impl(): move variable definitions to
  their first assignment.
* Fix test_posix.test_sched_getaffinity(): restore the old CPU mask
  when the test completes!
* Doc: Specify that os.cpu_count() counts *logicial* CPUs.
* Doc: Specify that os.sched_getaffinity(0) is related to the calling
  thread.

2 years agogh-109276: regrtest: add WORKER_FAILED state (#110148)
Victor Stinner [Sat, 30 Sep 2023 20:48:26 +0000 (22:48 +0200)] 
gh-109276: regrtest: add WORKER_FAILED state (#110148)

Rename WORKER_ERROR to WORKER_BUG. Add WORKER_FAILED state: it does
not stop the manager, whereas WORKER_BUG does.

Change also TestResults.display_result() order: display failed tests
at the end, the important important information.

WorkerThread now tries to get the signal name for negative exit code.

2 years agogh-110088: Fix asyncio test_prompt_cancellation() (#110157)
Victor Stinner [Sat, 30 Sep 2023 20:40:10 +0000 (22:40 +0200)] 
gh-110088: Fix asyncio test_prompt_cancellation() (#110157)

Don't measure the CI performance: don't test the maximum elapsed
time. The check failed on a slow CI.

2 years agogh-110014: Include explicitly <unistd.h> header (#110155)
Victor Stinner [Sat, 30 Sep 2023 20:06:45 +0000 (22:06 +0200)] 
gh-110014: Include explicitly <unistd.h> header (#110155)

* Remove unused <locale.h> includes.
* Remove unused <fcntl.h> include in traceback.h.
* Remove redundant <assert.h> and <stddef.h> includes. They  are already
  included by "Python.h".
* Remove <object.h> include in faulthandler.c. Python.h already includes it.
* Add missing <stdbool.h> in pycore_pythread.h if HAVE_PTHREAD_STUBS
  is defined.
* Fix also warnings in pthread_stubs.h: don't redefine macros if they
  are already defined, like the __NEED_pthread_t macro.

2 years agogh-109748: Fix again venv test_zippath_from_non_installed_posix() (#110149)
Victor Stinner [Sat, 30 Sep 2023 18:23:26 +0000 (20:23 +0200)] 
gh-109748: Fix again venv test_zippath_from_non_installed_posix() (#110149)

Call also copy_python_src_ignore() on listdir() names.

shutil.copytree(): replace set() with an empty tuple. An empty tuple
becomes a constant in the compiler and checking if an item is in an
empty tuple is cheap.

2 years agogh-110014: Fix _POSIX_THREADS and _POSIX_SEMAPHORES usage (#110139)
Victor Stinner [Sat, 30 Sep 2023 17:25:54 +0000 (19:25 +0200)] 
gh-110014: Fix _POSIX_THREADS and _POSIX_SEMAPHORES usage (#110139)

* pycore_pythread.h is now the central place to make sure that
  _POSIX_THREADS and _POSIX_SEMAPHORES macros are defined if
  available.
* Make sure that pycore_pythread.h is included when _POSIX_THREADS
  and _POSIX_SEMAPHORES macros are tested.
* PY_TIMEOUT_MAX is now defined as a constant, since its value
  depends on _POSIX_THREADS, instead of being defined as a macro.
* Prevent integer overflow in the preprocessor when computing
  PY_TIMEOUT_MAX_VALUE on Windows:
  replace "0xFFFFFFFELL * 1000 < LLONG_MAX"
  with "0xFFFFFFFELL < LLONG_MAX / 1000".
* Document the change and give hints how to fix affected code.
* Add an exception for PY_TIMEOUT_MAX  name to smelly.py
* Add PY_TIMEOUT_MAX to the stable ABI

2 years agogh-107954: Refactor initconfig.c: add CONFIG_SPEC (#110146)
Victor Stinner [Sat, 30 Sep 2023 17:24:06 +0000 (19:24 +0200)] 
gh-107954: Refactor initconfig.c: add CONFIG_SPEC (#110146)

Add a specification of the PyConfig structure to factorize the code.

2 years agoGH-89812: Add `pathlib._PathBase` (#106337)
Barney Gale [Sat, 30 Sep 2023 14:45:01 +0000 (15:45 +0100)] 
GH-89812: Add `pathlib._PathBase` (#106337)

Add private `pathlib._PathBase` class. This will be used by an experimental PyPI package to incubate a `tarfile.TarPath` class.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2 years agoGH-101100: Fix reference warnings for ``gettext`` (#110115)
Adam Turner [Sat, 30 Sep 2023 11:10:07 +0000 (12:10 +0100)] 
GH-101100: Fix reference warnings for ``gettext`` (#110115)

2 years agoGH-101100: Fix reference warnings for ``namedtuple`` (#110113)
Adam Turner [Sat, 30 Sep 2023 06:32:35 +0000 (07:32 +0100)] 
GH-101100: Fix reference warnings for ``namedtuple`` (#110113)

2 years agoAdd example for linear_regression() with proportional=True. (gh-110133)
Raymond Hettinger [Sat, 30 Sep 2023 04:18:12 +0000 (23:18 -0500)] 
Add example for linear_regression() with proportional=True. (gh-110133)

2 years agogh-107888: Fix test_mmap PROT_EXEC comment (#110125)
Victor Stinner [Fri, 29 Sep 2023 21:56:19 +0000 (23:56 +0200)] 
gh-107888: Fix test_mmap PROT_EXEC comment (#110125)

2 years agogh-110119: Temporarily skip test_cppext on --disable-gil builds. (#110123)
Sam Gross [Fri, 29 Sep 2023 20:50:51 +0000 (20:50 +0000)] 
gh-110119: Temporarily skip test_cppext on --disable-gil builds. (#110123)

The current version of pip does not support "t" in the ABI flags. Skip
the test in `--disable-gil` builds until we can update pip.

2 years agogh-109566: regrtest --fast-ci no longer enables --nowindows (#110121)
Victor Stinner [Fri, 29 Sep 2023 19:49:39 +0000 (21:49 +0200)] 
gh-109566: regrtest --fast-ci no longer enables --nowindows (#110121)

The --nowindows option is deprecated and does nothing but logs a
warning.

2 years agogh-109566: Remove make testall (#110122)
Victor Stinner [Fri, 29 Sep 2023 19:36:03 +0000 (21:36 +0200)] 
gh-109566: Remove make testall (#110122)

Remove "make testall" target: use "make buildbottest" instead.

2 years agogh-109047: concurrent.futures catches PythonFinalizationError (#109810)
Victor Stinner [Fri, 29 Sep 2023 19:31:19 +0000 (21:31 +0200)] 
gh-109047: concurrent.futures catches PythonFinalizationError (#109810)

concurrent.futures: The *executor manager thread* now catches
exceptions when adding an item to the *call queue*. During Python
finalization, creating a new thread can now raise RuntimeError. Catch
the exception and call terminate_broken() in this case.

Add test_python_finalization_error() to test_concurrent_futures.

concurrent.futures._ExecutorManagerThread changes:

* terminate_broken() no longer calls shutdown_workers() since the
  call queue is no longer working anymore (read and write ends of
  the queue pipe are closed).
* terminate_broken() now terminates child processes, not only
  wait until they complete.
* _ExecutorManagerThread.terminate_broken() now holds shutdown_lock
  to prevent race conditons with ProcessPoolExecutor.submit().

multiprocessing.Queue changes:

* Add _terminate_broken() method.
* _start_thread() sets _thread to None on exception to prevent
  leaking "dangling threads" even if the thread was not started
  yet.

2 years agogh-109566: PCbuild/rt.bat now uses --fast-ci (#110120)
Victor Stinner [Fri, 29 Sep 2023 19:16:29 +0000 (21:16 +0200)] 
gh-109566: PCbuild/rt.bat now uses --fast-ci (#110120)

Replace "--fail-env-changed --fail-rerun" with "--fast-ci".

Tools/buildbot/test.bat pass --slow-ci which has the priority over
--fast-ci.

2 years agogh-66143: Allow copying and pickling of CodecInfo object (GH-109235)
Furkan Onder [Fri, 29 Sep 2023 17:07:09 +0000 (20:07 +0300)] 
gh-66143: Allow copying and pickling of CodecInfo object (GH-109235)

Co-authored-by: Robert Lehmann <mail@robertlehmann.de>
2 years agogh-109495: Remove unused slots from the Python implementation of datetime (GH-109494)
James Hilton-Balfe [Fri, 29 Sep 2023 16:57:32 +0000 (17:57 +0100)] 
gh-109495: Remove unused slots from the Python implementation of datetime (GH-109494)

2 years agogh-109615: Look for 'Modules' as landmark for test_copy_python_src_ignore (GH-110108)
Steve Dower [Fri, 29 Sep 2023 15:24:38 +0000 (16:24 +0100)] 
gh-109615: Look for 'Modules' as landmark for test_copy_python_src_ignore (GH-110108)