]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
20 months agogh-76511: Fix email.Message.as_string() for non-ASCII message with ASCII charset...
Serhiy Storchaka [Tue, 5 Mar 2024 15:49:01 +0000 (17:49 +0200)] 
gh-76511: Fix email.Message.as_string() for non-ASCII message with ASCII charset (GH-116125)

20 months agoFix the PyGetSetDef documentation (GH-116056)
Serhiy Storchaka [Tue, 5 Mar 2024 15:48:20 +0000 (17:48 +0200)] 
Fix the PyGetSetDef documentation (GH-116056)

closure is not a function pointer, it is a user data pointer.

20 months agogh-115777: Fix double versionadded directives (GH-116269)
Serhiy Storchaka [Tue, 5 Mar 2024 15:41:53 +0000 (17:41 +0200)] 
gh-115777: Fix double versionadded directives (GH-116269)

20 months agoGH-115685: Split `_TO_BOOL_ALWAYS_TRUE` into micro-ops (GH-116352)
Mark Shannon [Tue, 5 Mar 2024 15:23:08 +0000 (15:23 +0000)] 
GH-115685: Split `_TO_BOOL_ALWAYS_TRUE` into micro-ops (GH-116352)

20 months agoGH-115819: Eliminate Boolean guards when value is known (GH-116355)
Mark Shannon [Tue, 5 Mar 2024 15:06:00 +0000 (15:06 +0000)] 
GH-115819: Eliminate Boolean guards when value is known (GH-116355)

20 months agogh-116326: Handler errors correctly in `getwindowsversion` in `sysmodule` (#116339)
Nikita Sobolev [Tue, 5 Mar 2024 12:31:04 +0000 (15:31 +0300)] 
gh-116326: Handler errors correctly in `getwindowsversion` in `sysmodule` (#116339)

20 months agoGH-115685: Optimize `TO_BOOL` and variants based on truthiness of input. (GH-116311)
Mark Shannon [Tue, 5 Mar 2024 11:23:46 +0000 (11:23 +0000)] 
GH-115685: Optimize `TO_BOOL` and variants based on truthiness of input. (GH-116311)

20 months agogh-116325: Raise `SyntaxError` rather than `IndexError` on ForwardRef with empty...
Nikita Sobolev [Tue, 5 Mar 2024 09:14:18 +0000 (12:14 +0300)] 
gh-116325: Raise `SyntaxError` rather than `IndexError` on ForwardRef with empty string arg (#116341)

20 months agogh-112075: Enable freeing with qsbr and fallback to lock on key changed (GH-116336)
Dino Viehland [Tue, 5 Mar 2024 09:08:18 +0000 (01:08 -0800)] 
gh-112075: Enable freeing with qsbr and fallback to lock on key changed (GH-116336)

20 months agoGH-116313: get WASI builds to run under wasmtime 18 w/ WASI 0.2/preview2 primitives...
Brett Cannon [Tue, 5 Mar 2024 08:18:53 +0000 (00:18 -0800)] 
GH-116313: get WASI builds to run under wasmtime 18 w/ WASI 0.2/preview2 primitives (#116327)

* GH-116313: get WASI builds to run under wasmtime 18 w/ WASI 0.2/preview2 primitives

* Add the configure changes

* Update `wasm_build.py`

20 months agogh-112087: Make list_{slice, ass_slice, subscript} to be threadsafe (gh-116233)
Donghee Na [Tue, 5 Mar 2024 04:58:14 +0000 (13:58 +0900)] 
gh-112087: Make list_{slice, ass_slice, subscript} to be threadsafe (gh-116233)

20 months agogh-116029: Fix unused function warning on macOS (#116340)
Sam Gross [Tue, 5 Mar 2024 03:06:21 +0000 (22:06 -0500)] 
gh-116029: Fix unused function warning on macOS (#116340)

20 months agogh-116265: Remove obsolete sentence. (#116284)
Terry Jan Reedy [Mon, 4 Mar 2024 21:49:42 +0000 (16:49 -0500)] 
gh-116265: Remove obsolete sentence. (#116284)

Remove sentence in Tools/c-analyzer/README referring to deleted
ignore-globals.txt.

20 months agogh-115490: Make the interpreter.channels and interpreter.queues Modules Handle Reload...
Eric Snow [Mon, 4 Mar 2024 20:59:30 +0000 (13:59 -0700)] 
gh-115490: Make the interpreter.channels and interpreter.queues Modules Handle Reloading Properly (gh-115493)

The problem manifested when the .py module got reloaded and the corresponding extension module didn't. The .py module registers types with the extension and the extension was not allowing that to happen more than once. The solution: let it happen more than once.

20 months agogh-115320: Refactor `get_hash_info` in `sysmodule.c` not to swallow errors (#115321)
Nikita Sobolev [Mon, 4 Mar 2024 20:03:59 +0000 (23:03 +0300)] 
gh-115320: Refactor `get_hash_info` in `sysmodule.c` not to swallow errors (#115321)

20 months agogh-76785: Simplify Channels XID Types (gh-116318)
Eric Snow [Mon, 4 Mar 2024 19:32:39 +0000 (12:32 -0700)] 
gh-76785: Simplify Channels XID Types (gh-116318)

I had added an extra cleanup abstraction a while back that has turned out to be unnecessary.

20 months agoGH-116134: JIT aarch64-pc-windows-msvc (GH-116130)
Brandt Bucher [Mon, 4 Mar 2024 18:16:56 +0000 (10:16 -0800)] 
GH-116134: JIT aarch64-pc-windows-msvc (GH-116130)

20 months agoGH-115802: Don't JIT zero-length jumps (GH-116177)
Brandt Bucher [Mon, 4 Mar 2024 18:13:10 +0000 (10:13 -0800)] 
GH-115802: Don't JIT zero-length jumps (GH-116177)

20 months agogh-116316: Fix typo in `UNARY_FUNC(PyNumber_Positive)` macros (GH-116317)
Kirill Podoprigora [Mon, 4 Mar 2024 17:57:01 +0000 (19:57 +0200)] 
gh-116316: Fix typo in `UNARY_FUNC(PyNumber_Positive)` macros (GH-116317)

20 months agogh-57141: Add dircmp shallow option (GH-109499)
Tobias Rautenkranz [Mon, 4 Mar 2024 17:27:43 +0000 (18:27 +0100)] 
gh-57141: Add dircmp shallow option (GH-109499)

Co-authored-by: Steve Ward <planet36@gmail.com>
Co-authored-by: Sanyam Khurana <8039608+CuriousLearner@users.noreply.github.com>
20 months agogh-108562: Revert enabling -fstrict-overflow for libmpdec (GH-116302)
Sergey B Kirpichev [Mon, 4 Mar 2024 17:07:24 +0000 (20:07 +0300)] 
gh-108562: Revert enabling -fstrict-overflow for libmpdec (GH-116302)

gh-108562: partial reversion of pr114751

Reverts -fstrict-overflow for libmpdec

20 months agogh-116116: Backport blake2 change to fix building with clang-cl on windows-i686 ...
Yuriy Chernyshov [Mon, 4 Mar 2024 16:59:57 +0000 (17:59 +0100)] 
gh-116116: Backport blake2 change to fix building with clang-cl on windows-i686 (GH-116117)

20 months agogh-115832: Fix instrumentation version mismatch during interpreter shutdown (#115856)
Brett Simmers [Mon, 4 Mar 2024 16:29:39 +0000 (08:29 -0800)] 
gh-115832: Fix instrumentation version mismatch during interpreter shutdown (#115856)

A previous commit introduced a bug to `interpreter_clear()`: it set
`interp->ceval.instrumentation_version` to 0, without making the corresponding
change to `tstate->eval_breaker` (which holds a thread-local copy of the
version). After this happens, Python code can still run due to object finalizers
during a GC, and the version check in bytecodes.c will see a different result
than the one in instrumentation.c causing an infinite loop.

The fix itself is straightforward: clear `tstate->eval_breaker` when clearing
`interp->ceval.instrumentation_version`.

20 months agoConsistently spell out *predicate* instead of *pred*. (gh-116308)
Raymond Hettinger [Mon, 4 Mar 2024 15:51:29 +0000 (09:51 -0600)] 
Consistently spell out *predicate* instead of *pred*. (gh-116308)

20 months agogh-115256: Remove refcycles from tarfile writing (GH-115257)
pan324 [Mon, 4 Mar 2024 13:26:32 +0000 (14:26 +0100)] 
gh-115256: Remove refcycles from tarfile writing (GH-115257)

20 months agogh-114258: Argument Clinic: refactor getset implementation (#116170)
Erlend E. Aasland [Mon, 4 Mar 2024 12:51:28 +0000 (13:51 +0100)] 
gh-114258: Argument Clinic: refactor getset implementation (#116170)

* Move param guard to param state machine
* Override return converter during parsing
* Don't use a custom type slot return converter; instead
  special case type slot functions during generation.

20 months agoGH-116271 Docs: provide clarification for object assignments in the Tutorial section...
Kerim Kabirov [Mon, 4 Mar 2024 12:22:13 +0000 (13:22 +0100)] 
GH-116271 Docs: provide clarification for object assignments in the Tutorial section (#116283)

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
20 months agogh-115398: Increment PyExpat_CAPI_MAGIC for SetReparseDeferralEnabled addition (GH...
Gregory P. Smith [Mon, 4 Mar 2024 10:36:27 +0000 (02:36 -0800)] 
gh-115398: Increment PyExpat_CAPI_MAGIC for SetReparseDeferralEnabled addition (GH-116301)

* Increment PyExpat_CAPI_MAGIC due to SetReparseDeferralEnabled addition.

This is a followup to git commit
6a95676bb526261434dd068d6c49927c44d24a9b from Github PR #115623.

* RESTify news API list.

20 months agogh-116296: Fix refleak in reduce_newobj() corner case (#116297)
Erlend E. Aasland [Mon, 4 Mar 2024 09:46:18 +0000 (10:46 +0100)] 
gh-116296: Fix refleak in reduce_newobj() corner case (#116297)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
20 months agopathlib ABCs: follow all symlinks in `PathBase.glob()` (#116293)
Barney Gale [Mon, 4 Mar 2024 02:26:33 +0000 (02:26 +0000)] 
pathlib ABCs: follow all symlinks in `PathBase.glob()` (#116293)

Switch the default value of *follow_symlinks* from `None` to `True` in
`pathlib._abc.PathBase.glob()` and `rglob()`. This speeds up recursive
globbing.

No change to the public pathlib classes.

20 months agogh-116010: Remove link to deprecated PEP 6 in FAQ guide (#116246)
Iman Tabrizian [Sun, 3 Mar 2024 19:50:18 +0000 (23:20 +0330)] 
gh-116010: Remove link to deprecated PEP 6 in FAQ guide (#116246)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
20 months agogh-116281: Remove wrong '\' from '\*' in some doc signatures (#116282)
HarryLHW [Sun, 3 Mar 2024 19:32:32 +0000 (03:32 +0800)] 
gh-116281: Remove wrong '\' from '\*' in some doc signatures (#116282)

20 months agoDocs: update using/configure.rst (#116274)
Hugo van Kemenade [Sun, 3 Mar 2024 15:40:02 +0000 (17:40 +0200)] 
Docs: update using/configure.rst (#116274)

20 months agogh-115809: Improve TimedRotatingFileHandler.getFilesToDelete() (GH-115812)
Serhiy Storchaka [Sun, 3 Mar 2024 07:42:08 +0000 (09:42 +0200)] 
gh-115809: Improve TimedRotatingFileHandler.getFilesToDelete() (GH-115812)

Improve algorithm for computing which rolled-over log files to delete
in logging.TimedRotatingFileHandler. It is now reliable for handlers
without namer and with arbitrary deterministic namer that leaves
the datetime part in the file name unmodified.

20 months agogh-108562: Fix compiler warnings for libmpdec (#114751)
Sergey B Kirpichev [Sun, 3 Mar 2024 07:25:39 +0000 (10:25 +0300)] 
gh-108562: Fix compiler warnings for libmpdec (#114751)

If awailable, enable -fstrict-overflow for libmpdec. Also
shut off false positive warnings (-Warray-bounds).

The later was backported from mpdecimal-4.0.0.

20 months agogh-72971: Clarify the special no-TypeError behavior for equality (#110729)
Gouvernathor [Sun, 3 Mar 2024 00:45:48 +0000 (01:45 +0100)] 
gh-72971: Clarify the special no-TypeError behavior for equality (#110729)

20 months agogh-115103: Update gc.collect to process delayed objects (gh-116251)
Donghee Na [Sat, 2 Mar 2024 22:04:29 +0000 (07:04 +0900)] 
gh-115103: Update gc.collect to process delayed objects (gh-116251)

* Revert "gh-115103: Update refleak checker to trigger _PyMem_ProcessDelayed (gh-116238)"

This reverts commit 2e91578a76d38fa8895fce95e2661618c3de892c.

* gh-115103: Update gc.collect to process delayed objects

20 months agogh-115103: Update refleak checker to trigger _PyMem_ProcessDelayed (gh-116238)
Donghee Na [Sat, 2 Mar 2024 21:44:16 +0000 (06:44 +0900)] 
gh-115103: Update refleak checker to trigger _PyMem_ProcessDelayed (gh-116238)

20 months agogh-85644: webbrowser: Use $XDG_CURRENT_DESKTOP to check desktop (GH-21731)
Marco Trevisan [Sat, 2 Mar 2024 12:48:24 +0000 (13:48 +0100)] 
gh-85644: webbrowser: Use $XDG_CURRENT_DESKTOP to check desktop (GH-21731)

Usage of $GNOME_DESKTOP_SESSION_ID env variable is deprecated since
GNOME 3.30.0 [1], so should not be used, while the standard
XDG_CURRENT_DESKTOP should be instead preferred.

[1] https://gitlab.gnome.org/GNOME/gnome-session/-/commit/00e0e6226371d53f65

20 months agoGH-115978: Disable `*readv()` and `*writev()` on WASI (GH-116228)
Brett Cannon [Sat, 2 Mar 2024 00:52:12 +0000 (16:52 -0800)] 
GH-115978: Disable `*readv()` and `*writev()` on WASI (GH-116228)

Wasmtime doesn't implement these functions in a way to pass test_posix (https://github.com/bytecodealliance/wasmtime/issues/7830).

20 months agogh-116102: Silence a Compiler Warning in _xxinterpqueues (gh-116230)
Eric Snow [Sat, 2 Mar 2024 00:28:05 +0000 (17:28 -0700)] 
gh-116102: Silence a Compiler Warning in _xxinterpqueues (gh-116230)

20 months agogh-112087: Use QSBR technique for list_new/clear for free-thread build (gh-115875)
Donghee Na [Fri, 1 Mar 2024 23:30:35 +0000 (08:30 +0900)] 
gh-112087: Use QSBR technique for list_new/clear for free-thread build (gh-115875)

20 months agoGH-116226: include `pthread_stubs.h` in `pycore_pythreads.h` (#116227)
Brett Cannon [Fri, 1 Mar 2024 23:22:31 +0000 (15:22 -0800)] 
GH-116226: include `pthread_stubs.h` in `pycore_pythreads.h` (#116227)

20 months agogh-114271: Make `_thread.ThreadHandle` thread-safe in free-threaded builds (GH-115190)
mpage [Fri, 1 Mar 2024 21:43:12 +0000 (13:43 -0800)] 
gh-114271: Make `_thread.ThreadHandle` thread-safe in free-threaded builds (GH-115190)

Make `_thread.ThreadHandle` thread-safe in free-threaded builds

We protect the mutable state of `ThreadHandle` using a `_PyOnceFlag`.
Concurrent operations (i.e. `join` or `detach`) on `ThreadHandle` block
until it is their turn to execute or an earlier operation succeeds.
Once an operation has been applied successfully all future operations
complete immediately.

The `join()` method is now idempotent. It may be called multiple times
but the underlying OS thread will only be joined once. After `join()`
succeeds, any future calls to `join()` will succeed immediately.

The internal thread handle `detach()` method has been removed.

20 months agogh-115941: fixes in dictobject.c doc block(#116196)
Humbulani [Fri, 1 Mar 2024 19:48:26 +0000 (21:48 +0200)] 
gh-115941: fixes in dictobject.c doc block(#116196)

20 months agogh-115480: Type propagate _BINARY_OP_ADD_UNICODE (GH-115710)
Ken Jin [Fri, 1 Mar 2024 19:40:04 +0000 (03:40 +0800)] 
gh-115480: Type propagate _BINARY_OP_ADD_UNICODE (GH-115710)

20 months agogh-84995: Run sys.__interactivehook__() on asyncio REPL startup (#20517)
Rémi Lapeyre [Fri, 1 Mar 2024 19:39:16 +0000 (20:39 +0100)] 
gh-84995: Run sys.__interactivehook__() on asyncio REPL startup (#20517)

This makes the asyncio REPL (`python -m asyncio`) more usable
and similar to the regular REPL.

This exposes register_readline() as a top-level function in site.py,
but it's intentionally undocumented.

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Itamar Oren <itamarost@gmail.com>
20 months agogh-115773: Add missing preprocessor guard in _testexternalinspection (#116212)
Malcolm Smith [Fri, 1 Mar 2024 17:50:48 +0000 (17:50 +0000)] 
gh-115773: Add missing preprocessor guard in _testexternalinspection (#116212)

Add missing preprocessor guard in _testexternalinspection

20 months agogh-116171: Argument Clinic: disallow overriding return converter for __init__ methods...
Erlend E. Aasland [Fri, 1 Mar 2024 17:41:20 +0000 (18:41 +0100)] 
gh-116171: Argument Clinic: disallow overriding return converter for __init__ methods (#116172)

20 months agogh-115806: Don't mangle output of configure 'ipv6 stack type' check (#116165)
Erlend E. Aasland [Fri, 1 Mar 2024 17:38:32 +0000 (18:38 +0100)] 
gh-115806: Don't mangle output of configure 'ipv6 stack type' check (#116165)

20 months agogh-104711: Add security warning to the CGIHTTPRequestHandler document (GH-115915)
AN Long [Fri, 1 Mar 2024 17:25:14 +0000 (01:25 +0800)] 
gh-104711: Add security warning to the CGIHTTPRequestHandler document (GH-115915)

20 months agogh-116035: Document that both tzinfo and fold are ignored in comparisons if tzinfo...
Serhiy Storchaka [Fri, 1 Mar 2024 17:16:29 +0000 (19:16 +0200)] 
gh-116035: Document that both tzinfo and fold are ignored in comparisons if tzinfo is the same (GH-116187)

This mostly restores information removed in c12240ed28aac6494750e00143bc550c4d6d8ad1 (GH-114749).

20 months agogh-76785: Fix interpreters.Queue.get_nowait() (gh-116166)
Eric Snow [Fri, 1 Mar 2024 16:36:35 +0000 (09:36 -0700)] 
gh-76785: Fix interpreters.Queue.get_nowait() (gh-116166)

I missed this change in gh-115566.

20 months agogh-112281: Allow `Union` with unhashable `Annotated` metadata (#112283)
Nikita Sobolev [Fri, 1 Mar 2024 16:19:24 +0000 (19:19 +0300)] 
gh-112281: Allow `Union` with unhashable `Annotated` metadata (#112283)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
20 months agogh-104219: Document that idunders can return NotImplemented (#104220)
Gouvernathor [Fri, 1 Mar 2024 15:51:47 +0000 (16:51 +0100)] 
gh-104219: Document that idunders can return NotImplemented (#104220)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
20 months agogh-88352: Fix logging.TimedRotatingFileHandler (GH-116191)
Serhiy Storchaka [Fri, 1 Mar 2024 15:50:08 +0000 (17:50 +0200)] 
gh-88352: Fix logging.TimedRotatingFileHandler (GH-116191)

* Do not overwrite already rolled over files. It happened at midnight or
  during the DST change and caused the loss of data.
* computeRollover() now always return the timestamp larger than the
  specified time.
* Fix computation of the rollover time during the DST change.

20 months agogh-115554: Improved logic for handling multiple existing py.exe launcher installs...
Steve Dower [Fri, 1 Mar 2024 12:58:27 +0000 (12:58 +0000)] 
gh-115554: Improved logic for handling multiple existing py.exe launcher installs (GH-115793)

20 months agogh-101293: Fix support of custom callables and types in inspect.Signature.from_callab...
Serhiy Storchaka [Fri, 1 Mar 2024 11:32:16 +0000 (13:32 +0200)] 
gh-101293: Fix support of custom callables and types in inspect.Signature.from_callable() (GH-115530)

Support callables with the __call__() method and types with
__new__() and __init__() methods set to class methods, static
methods, bound methods, partial functions, and other types of
methods and descriptors.

Add tests for numerous types of callables and descriptors.

20 months agobuild(deps-dev): bump types-setuptools from 69.0.0.20240125 to 69.1.0.20240301 in...
dependabot[bot] [Fri, 1 Mar 2024 11:08:46 +0000 (11:08 +0000)] 
build(deps-dev): bump types-setuptools from 69.0.0.20240125 to 69.1.0.20240301 in /Tools (#116190)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
20 months agogh-116159: argparse: performance improvement parsing large number of options (#116162)
Amethyst Reese [Fri, 1 Mar 2024 10:52:53 +0000 (02:52 -0800)] 
gh-116159: argparse: performance improvement parsing large number of options (#116162)

When parsing positional vs optional arguments, the use of min with a
list comprehension inside of a loop results in quadratic time based
on the number of optional arguments given. When combined with use of
prefix based argument files and a large number of optional flags, this
can result in extremely slow parsing behavior.

This replaces the min call with a simple loop with a short circuit to
break at the next optional argument.

Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
20 months agobuild(deps): bump hypothesis from 6.97.4 to 6.98.15 in /Tools (#116189)
dependabot[bot] [Fri, 1 Mar 2024 10:27:35 +0000 (10:27 +0000)] 
build(deps): bump hypothesis from 6.97.4 to 6.98.15 in /Tools (#116189)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
20 months agobuild(deps-dev): bump types-psutil from 5.9.5.20240106 to 5.9.5.20240205 in /Tools...
dependabot[bot] [Fri, 1 Mar 2024 10:24:27 +0000 (10:24 +0000)] 
build(deps-dev): bump types-psutil from 5.9.5.20240106 to 5.9.5.20240205 in /Tools (#116188)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
20 months agogh-65824: Improve the "less" prompt in pydoc (GH-116050)
Serhiy Storchaka [Fri, 1 Mar 2024 08:03:32 +0000 (10:03 +0200)] 
gh-65824: Improve the "less" prompt in pydoc (GH-116050)

Output the line number, the percentage and the help about how to get help
or quit the pager.

Inspired by the GNU man.

20 months agogh-116098: Revert "gh-107674: Improve performance of `sys.settrace` (GH-114986)"...
Tian Gao [Fri, 1 Mar 2024 06:46:33 +0000 (22:46 -0800)] 
gh-116098: Revert "gh-107674: Improve performance of `sys.settrace` (GH-114986)" (GH-116178)

Revert "gh-107674: Improve performance of `sys.settrace` (GH-114986)"

This reverts commit 0a61e237009bf6b833e13ac635299ee063377699.

20 months agogh-115999: Disable the specializing adaptive interpreter in free-threaded builds...
Brett Simmers [Fri, 1 Mar 2024 02:53:32 +0000 (18:53 -0800)] 
gh-115999: Disable the specializing adaptive interpreter in free-threaded builds (#116013)

For now, disable all specialization when the GIL might be disabled.

20 months agogh-116099: Fix refcounting bug in `_queueobj_shared()` (gh-116164)
Brett Simmers [Fri, 1 Mar 2024 01:02:12 +0000 (17:02 -0800)] 
gh-116099: Fix refcounting bug in `_queueobj_shared()` (gh-116164)

This code decrefs `qidobj` twice in some paths. Since `qidobj` isn't used after
the first `Py_DECREF()`, remove the others, and replace the `Py_DECREF()` with
`Py_CLEAR()` to make it clear that the variable is dead.

With this fix, `python -mtest test_interpreters -R 3:3 -mtest_queues` no longer
fails with `_Py_NegativeRefcount: Assertion failed: object has negative ref
count`.

20 months agogh-115491: Fix Clang compiler warning (#116153)
Sam Gross [Fri, 1 Mar 2024 00:02:44 +0000 (19:02 -0500)] 
gh-115491: Fix Clang compiler warning (#116153)

gh-115491: Fix compiler warning on macOS

20 months agogh-103092: Add a mutex to make the PRNG state of rotatingtree concurrent-safe (#115301)
AN Long [Thu, 29 Feb 2024 23:04:16 +0000 (07:04 +0800)] 
gh-103092: Add a mutex to make the PRNG state of rotatingtree concurrent-safe (#115301)

20 months agogh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) (GH-115623)
Sebastian Pipping [Thu, 29 Feb 2024 22:52:50 +0000 (23:52 +0100)] 
gh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) (GH-115623)

Allow controlling Expat >=2.6.0 reparse deferral (CVE-2023-52425) by adding five new methods:

- `xml.etree.ElementTree.XMLParser.flush`
- `xml.etree.ElementTree.XMLPullParser.flush`
- `xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`
- `xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`
- `xml.sax.expatreader.ExpatParser.flush`

Based on the "flush" idea from https://github.com/python/cpython/pull/115138#issuecomment-1932444270 .

### Notes

- Please treat as a security fix related to CVE-2023-52425.

Includes code suggested-by: Snild Dolkow <snild@sony.com>
and by core dev Serhiy Storchaka.

20 months agogh-115685: Type/values propagate for TO_BOOL in tier 2 (GH-115686)
Ken Jin [Thu, 29 Feb 2024 22:13:38 +0000 (06:13 +0800)] 
gh-115685: Type/values propagate for TO_BOOL in tier 2 (GH-115686)

20 months agoFix rendering of null character in ast.rst (#116080)
Shantanu [Thu, 29 Feb 2024 22:09:06 +0000 (14:09 -0800)] 
Fix rendering of null character in ast.rst (#116080)

20 months agogh-71052: Fix several Android build issues (#115955)
Malcolm Smith [Thu, 29 Feb 2024 21:58:20 +0000 (21:58 +0000)] 
gh-71052: Fix several Android build issues (#115955)

This change is part of the work on PEP-738: Adding Android as a
supported platform.

* Remove the "1.0" suffix from libpython's filename on Android, which
  would prevent Gradle from packaging it into an app.
* Simplify the build command in the Makefile so that libpython always
  gets given an SONAME with the `-Wl-h` argument, even if the SONAME is
  identical to the actual filename.
* Disable a number of functions on Android which can be compiled and
  linked against, but always fail at runtime. As a result, the native
  _multiprocessing module is no longer built for Android.
* gh-115390 (bee7bb331) added some pre-determined results to the
  configure script for things that can't be autodetected when
  cross-compiling; this change adds Android to these where appropriate.
* Add a couple more pre-determined results for Android, and making them
  cover iOS as well. This means the --enable-ipv6 configure option will
  no longer be required on either platform.

20 months agogh-87115: Set `__main__.__spec__` to `None` in pdb (#116141)
Tian Gao [Thu, 29 Feb 2024 21:39:50 +0000 (13:39 -0800)] 
gh-87115: Set `__main__.__spec__` to `None` in pdb (#116141)

20 months agogh-112075: Avoid locking shared keys on every assignment (#116087)
Dino Viehland [Thu, 29 Feb 2024 21:38:50 +0000 (13:38 -0800)] 
gh-112075: Avoid locking shared keys on every assignment (#116087)

20 months agogh-71052: Add test exclusions to support running the test suite on Android (#115918)
Malcolm Smith [Thu, 29 Feb 2024 21:32:50 +0000 (21:32 +0000)] 
gh-71052: Add test exclusions to support running the test suite on Android (#115918)

20 months agogh-108051: Update versions found by find_python.bat and clarify readme (GH-116118)
Steve Dower [Thu, 29 Feb 2024 21:24:05 +0000 (21:24 +0000)] 
gh-108051: Update versions found by find_python.bat and clarify readme (GH-116118)

20 months agogh-73580: Docs for tunnelling TLS through TLS (GH-22539)
Carl Bordum Hansen [Thu, 29 Feb 2024 20:56:04 +0000 (21:56 +0100)] 
gh-73580: Docs for tunnelling TLS through TLS (GH-22539)

20 months agoDocs: mark up NotImplemented using the :data: role throughout the docs (#116135)
Erlend E. Aasland [Thu, 29 Feb 2024 20:46:12 +0000 (21:46 +0100)] 
Docs: mark up NotImplemented using the :data: role throughout the docs (#116135)

20 months agogh-116088: Insert bottom checks after all sym_set_...() calls (#116089)
Guido van Rossum [Thu, 29 Feb 2024 18:55:29 +0000 (10:55 -0800)] 
gh-116088: Insert bottom checks after all sym_set_...() calls (#116089)

This changes the `sym_set_...()` functions to return a `bool` which is `false`
when the symbol is `bottom` after the operation.

All calls to such functions now check this result and go to `hit_bottom`,
a special error label that prints a different message and then reports
that it wasn't able to optimize the trace. No executor will be produced
in this case.

20 months agogh-115811: Update documentation to add some Logger attributes. (GH-116109)
Vinay Sajip [Thu, 29 Feb 2024 18:53:19 +0000 (18:53 +0000)] 
gh-115811: Update documentation to add some Logger attributes. (GH-116109)

20 months agogh-72463: Fix ctypes/test_loading.py so that test_find reports skipped (GH-18312)
Michael Felt [Thu, 29 Feb 2024 18:37:31 +0000 (19:37 +0100)] 
gh-72463: Fix ctypes/test_loading.py so that test_find reports skipped (GH-18312)

20 months agoMake the iter_except() recipe more compact. (gh-116132)
Raymond Hettinger [Thu, 29 Feb 2024 17:30:18 +0000 (11:30 -0600)] 
Make the iter_except() recipe more compact. (gh-116132)

Only one example is needed

20 months agoGH-115802: JIT "small" code for Windows (GH-115964)
Brandt Bucher [Thu, 29 Feb 2024 16:11:28 +0000 (08:11 -0800)] 
GH-115802: JIT "small" code for Windows (GH-115964)

20 months agogh-112844: Add SBOM for external dependencies (#115789)
Seth Michael Larson [Thu, 29 Feb 2024 15:38:04 +0000 (09:38 -0600)] 
gh-112844: Add SBOM for external dependencies (#115789)

20 months agogh-116100: Add `test` arg to `ast.If` and `op` arg to `ast.BoolOp` calls (#116101)
Kirill Podoprigora [Thu, 29 Feb 2024 14:59:24 +0000 (16:59 +0200)] 
gh-116100: Add `test` arg to `ast.If` and `op` arg to `ast.BoolOp` calls (#116101)

20 months agogh-115881: Document feature_version limitations (#115980)
Shantanu [Thu, 29 Feb 2024 11:09:09 +0000 (03:09 -0800)] 
gh-115881: Document feature_version limitations (#115980)

20 months agogh-116103: Prevent error in WindowsLoadTracker.__del__ on permission error (GH-116105)
Petr Viktorin [Thu, 29 Feb 2024 10:40:18 +0000 (11:40 +0100)] 
gh-116103: Prevent error in WindowsLoadTracker.__del__ on permission error (GH-116105)

gh-116103: Prevent error in WindowsLoadTracker.__del__ if there was a permission error

20 months agogh-115937: Remove implementation details from inspect.signature() docs (#116086)
Erlend E. Aasland [Thu, 29 Feb 2024 09:42:28 +0000 (10:42 +0100)] 
gh-115937: Remove implementation details from inspect.signature() docs (#116086)

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
20 months agogh-115816: Generate calls to sym_new_const() etc. without _Py_uop prefix (#116077)
Guido van Rossum [Thu, 29 Feb 2024 00:05:53 +0000 (16:05 -0800)] 
gh-115816: Generate calls to sym_new_const() etc. without _Py_uop prefix (#116077)

This was left behind by GH-115987. Basically a lot of diffs like this:
```
-            res = _Py_uop_sym_new_unknown(ctx);
+            res = sym_new_unknown(ctx);
```

20 months agogh-115859: Fix test_type_inconsistency() when run multiple times (#116079)
Guido van Rossum [Wed, 28 Feb 2024 23:56:58 +0000 (15:56 -0800)] 
gh-115859: Fix test_type_inconsistency() when run multiple times (#116079)

This should fix the refleaks bots.

(See https://github.com/python/cpython/pull/116062#issuecomment-1970038174 .)

20 months agogh-115821: [Enum] better error message for calling super().__new__() (GH-116063)
Ethan Furman [Wed, 28 Feb 2024 23:17:49 +0000 (15:17 -0800)] 
gh-115821: [Enum] better error message for calling super().__new__() (GH-116063)

docs now state to not call super().__new__
if super().__new__ is called, a better error message is now used

20 months agogh-116075: Skip test_external_inspection on qemu in JIT CI (#116076)
Erlend E. Aasland [Wed, 28 Feb 2024 23:16:01 +0000 (00:16 +0100)] 
gh-116075: Skip test_external_inspection on qemu in JIT CI (#116076)

20 months agoUpdate an out-of-date example in the itertools recipe intro (gh-116082)
Raymond Hettinger [Wed, 28 Feb 2024 23:11:05 +0000 (17:11 -0600)] 
Update an out-of-date example in the itertools recipe intro (gh-116082)

20 months agogh-76785: Update test.support.interpreters to Align With PEP 734 (gh-115566)
Eric Snow [Wed, 28 Feb 2024 23:08:08 +0000 (16:08 -0700)] 
gh-76785: Update test.support.interpreters to Align With PEP 734 (gh-115566)

This brings the code under test.support.interpreters, and the corresponding extension modules, in line with recent updates to PEP 734.

(Note: PEP 734 has not been accepted at this time.  However, we are using an internal copy of the implementation in the test suite to exercise the existing subinterpreters feature.)

20 months agoImprove all_equal() recipe (gh-116081)
Raymond Hettinger [Wed, 28 Feb 2024 23:04:56 +0000 (17:04 -0600)] 
Improve all_equal() recipe (gh-116081)

Replace conjuction of next() calls with simpler len()/take() logic. Add key function.

20 months agogh-112075: Use relaxed stores for places where we may race with when reading lock...
Dino Viehland [Wed, 28 Feb 2024 22:53:19 +0000 (14:53 -0800)] 
gh-112075: Use relaxed stores for places where we may race with when reading lock-free (#115786)

20 months agogh-115859: Re-enable T2 optimizer pass by default (#116062)
Guido van Rossum [Wed, 28 Feb 2024 22:38:01 +0000 (14:38 -0800)] 
gh-115859: Re-enable T2 optimizer pass by default (#116062)

This undoes the *temporary* default disabling of the T2 optimizer pass in gh-115860.

- Add a new test that reproduces Brandt's example from gh-115859; it indeed crashes before gh-116028 with PYTHONUOPSOPTIMIZE=1
- Re-enable the optimizer pass in T2, stop checking PYTHONUOPSOPTIMIZE
- Rename the env var to disable T2 entirely to PYTHON_UOPS_OPTIMIZE (must be explicitly set to 0 to disable)
- Fix skipIf conditions on tests in test_opt.py accordingly
- Export sym_is_bottom() (for debugging)
- Fix various things in the `_BINARY_OP_` specializations in the abstract interpreter:
  - DECREF(temp)
  - out-of-space check after sym_new_const()
  - add sym_matches_type() checks, so even if we somehow reach a binary op with symbolic constants of the wrong type on the stack we won't trigger the type assert

20 months agogh-115891: Fix debug byte filling in free-threaded build (#116018)
Sam Gross [Wed, 28 Feb 2024 20:50:09 +0000 (15:50 -0500)] 
gh-115891: Fix debug byte filling in free-threaded build (#116018)

The previous code had two bugs. First, the debug offset in the mimalloc
heap includes the two pymalloc debug words, but the pointer passed to
fill_mem_debug does not include them. Second, the current object heap is
correct source for allocations, but not deallocations.

20 months agogh-112529: Simplify PyObject_GC_IsTracked and PyObject_GC_IsFinalized (#114732)
Sam Gross [Wed, 28 Feb 2024 20:37:59 +0000 (15:37 -0500)] 
gh-112529: Simplify PyObject_GC_IsTracked and PyObject_GC_IsFinalized (#114732)

20 months agogh-115197: Stop resolving host in urllib.request proxy bypass (GH-115210)
Weii Wang [Wed, 28 Feb 2024 20:15:52 +0000 (04:15 +0800)] 
gh-115197: Stop resolving host in urllib.request proxy bypass (GH-115210)

Use of a proxy is intended to defer DNS for the hosts to the proxy itself, rather than a potential for information leak of the host doing DNS resolution itself for any reason.  Proxy bypass lists are strictly name based.  Most implementations of proxy support agree.