]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
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.

20 months agoGH-115986 Reorder pprint docs and amend some references (#116019)
Kerim Kabirov [Wed, 28 Feb 2024 19:43:05 +0000 (20:43 +0100)] 
GH-115986 Reorder pprint docs and amend some references (#116019)

Introduce a new subsubsection, 'Functions', for module level functions,
and place it before the PrettyPrinter class reference.

Also:
- Fix pprint.pprint() references so they properly link to the module
  level function.
- Add links to sys.stdout.

20 months agogh-115816: Improve internal symbols API in optimizer (#116028)
Guido van Rossum [Wed, 28 Feb 2024 17:55:56 +0000 (09:55 -0800)] 
gh-115816: Improve internal symbols API in optimizer (#116028)

- Any `sym_set_...` call that attempts to set conflicting information
  cause the symbol to become `bottom` (contradiction).
- All `sym_is...` and similar calls return false or NULL for `bottom`.
- Everything's tested.
- The tests still pass with `PYTHONUOPSOPTIMIZE=1`.

20 months agogh-112075: Remove compiler warning from apple clang (gh-115855)
Donghee Na [Wed, 28 Feb 2024 17:51:59 +0000 (02:51 +0900)] 
gh-112075: Remove compiler warning from apple clang (gh-115855)

20 months agogh-107674: Improve performance of `sys.settrace` (GH-114986)
Tian Gao [Wed, 28 Feb 2024 15:21:42 +0000 (07:21 -0800)] 
gh-107674: Improve performance of `sys.settrace` (GH-114986)

20 months agogh-116012: Preserve GetLastError() across calls to TlsGetValue on Windows (GH-116014)
Steve Dower [Wed, 28 Feb 2024 13:58:25 +0000 (13:58 +0000)] 
gh-116012: Preserve GetLastError() across calls to TlsGetValue on Windows (GH-116014)

20 months agodoc: Use super() in subclassed JSONEncoder examples (GH-115565)
Jan Max Meyer [Wed, 28 Feb 2024 13:54:12 +0000 (14:54 +0100)] 
doc: Use super() in subclassed JSONEncoder examples (GH-115565)

Replace calls to `json.JSONEncoder.default(self, obj)`
by `super().default(obj)` within the examples of the documentation.

20 months agogh-115765: Don't use deprecated AC_EGREP_* macros in configure.ac (#116016)
Erlend E. Aasland [Wed, 28 Feb 2024 13:35:41 +0000 (14:35 +0100)] 
gh-115765: Don't use deprecated AC_EGREP_* macros in configure.ac (#116016)

Rewrite using AX_CHECK_DEFINE and AC_CHECK_TYPES.

20 months agogh-78612: Mark up eval() using param list (#115212)
Erlend E. Aasland [Wed, 28 Feb 2024 13:03:50 +0000 (14:03 +0100)] 
gh-78612: Mark up eval() using param list (#115212)

Also mention that the 'expression' parameter can be a string.

20 months agogh-114911: Add CPUStopwatch test helper (GH-114912)
Petr Viktorin [Wed, 28 Feb 2024 11:53:48 +0000 (12:53 +0100)] 
gh-114911: Add CPUStopwatch test helper (GH-114912)

A few of our tests measure the time of CPU-bound operation, mainly
to avoid quadratic or worse behaviour.
Add a helper to ignore GC and time spent in other processes.

20 months agogh-116030: test_unparse: Add ``ctx`` argument to ``ast.Name`` calls (#116031)
Kirill Podoprigora [Wed, 28 Feb 2024 11:04:23 +0000 (13:04 +0200)] 
gh-116030: test_unparse: Add ``ctx`` argument to ``ast.Name`` calls (#116031)

20 months agogh-115773: Add tests to exercise the _Py_DebugOffsets structure (#115774)
Pablo Galindo Salgado [Wed, 28 Feb 2024 10:17:34 +0000 (10:17 +0000)] 
gh-115773: Add tests to exercise the _Py_DebugOffsets structure (#115774)

20 months agogh-105858: Expose some union-related objects as internal APIs (GH-116025)
Jelle Zijlstra [Wed, 28 Feb 2024 09:56:40 +0000 (01:56 -0800)] 
gh-105858: Expose some union-related objects as internal APIs (GH-116025)

We now use these in the AST parsing code after gh-105880. A few comparable types (e.g.,
NoneType) are already exposed as internal APIs.

20 months agogh-115961: Improve tests for compressed file-like objects (GH-115963)
Serhiy Storchaka [Wed, 28 Feb 2024 07:51:08 +0000 (09:51 +0200)] 
gh-115961: Improve tests for compressed file-like objects (GH-115963)

* Increase coverage for compressed file-like objects initialized with a
  file name, an open file object, a file object opened by file
  descriptor, and a file-like object without name and mode attributes
  (io.BytesIO)
* Increase coverage for name, fileno(), mode, readable(), writable(),
  seekable() in different modes and states
* No longer skip tests with bytes names
* Test objects implementing the path protocol, not just pathlib.Path.

20 months agogh-116026: Try disabling rebuilds of dependents in Homebrew (#116027)
Jelle Zijlstra [Wed, 28 Feb 2024 05:35:25 +0000 (21:35 -0800)] 
gh-116026: Try disabling rebuilds of dependents in Homebrew (#116027)

20 months agogh-105858: Improve AST node constructors (#105880)
Jelle Zijlstra [Wed, 28 Feb 2024 02:13:03 +0000 (18:13 -0800)] 
gh-105858: Improve AST node constructors (#105880)

Demonstration:

>>> ast.FunctionDef.__annotations__
{'name': <class 'str'>, 'args': <class 'ast.arguments'>, 'body': list[ast.stmt], 'decorator_list': list[ast.expr], 'returns': ast.expr | None, 'type_comment': str | None, 'type_params': list[ast.type_param]}
>>> ast.FunctionDef()
<stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'name'. This will become an error in Python 3.15.
<stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'args'. This will become an error in Python 3.15.
<ast.FunctionDef object at 0x101959460>
>>> node = ast.FunctionDef(name="foo", args=ast.arguments())
>>> node.decorator_list
[]
>>> ast.FunctionDef(whatever="you want", name="x", args=ast.arguments())
<stdin>:1: DeprecationWarning: FunctionDef.__init__ got an unexpected keyword argument 'whatever'. Support for arbitrary keyword arguments is deprecated and will be removed in Python 3.15.
<ast.FunctionDef object at 0x1019581f0>

20 months agogh-112997: Don't log arguments in asyncio unless debugging (#115667)
Pierre Ossman (ThinLinc team) [Wed, 28 Feb 2024 01:39:08 +0000 (02:39 +0100)] 
gh-112997: Don't log arguments in asyncio unless debugging (#115667)

Nothing else in Python generally logs the contents of variables, so this
can be very unexpected for developers and could leak sensitive
information in to terminals and log files.

20 months agogh-114914: Avoid keeping dead StreamWriter alive (#115661)
Pierre Ossman (ThinLinc team) [Wed, 28 Feb 2024 01:27:44 +0000 (02:27 +0100)] 
gh-114914: Avoid keeping dead StreamWriter alive (#115661)

In some cases we might cause a StreamWriter to stay alive even when the
application has dropped all references to it. This prevents us from
doing automatical cleanup, and complaining that the StreamWriter wasn't
properly closed.

Fortunately, the extra reference was never actually used for anything so
we can just drop it.

20 months agobpo-43952: Fix multiprocessing Listener authkey bug (GH-25845)
Miguel Brito [Tue, 27 Feb 2024 14:57:59 +0000 (14:57 +0000)] 
bpo-43952: Fix multiprocessing Listener authkey bug (GH-25845)

Listener.accept() no longer hangs when authkey is an empty bytes object.

20 months agogh-115315: Update time.rst to include microseconds field (%f) in chart (#115316)
Tahoma Software [Tue, 27 Feb 2024 13:33:05 +0000 (08:33 -0500)] 
gh-115315: Update time.rst to include microseconds field (%f) in chart (#115316)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
20 months agoGH-115816: Assorted naming and formatting changes to improve maintainability. (GH...
Mark Shannon [Tue, 27 Feb 2024 13:25:02 +0000 (13:25 +0000)] 
GH-115816: Assorted naming and formatting changes to improve maintainability. (GH-115987)

* Rename _Py_UOpsAbstractInterpContext to _Py_UOpsContext and _Py_UOpsSymType to _Py_UopsSymbol.

* #define shortened form of _Py_uop_... names for improved readability.

20 months agoGH-115816: Make tier2 optimizer symbols testable, and add a few tests. (GH-115953)
Mark Shannon [Tue, 27 Feb 2024 10:51:26 +0000 (10:51 +0000)] 
GH-115816: Make tier2 optimizer symbols testable, and add a few tests. (GH-115953)

20 months agogh-115720: Show number of leaks in huntrleaks progress reports (GH-115726)
Petr Viktorin [Tue, 27 Feb 2024 08:51:17 +0000 (09:51 +0100)] 
gh-115720: Show number of leaks in huntrleaks progress reports (GH-115726)

Instead of showing a dot for each iteration, show:
- '.' for zero (on negative) leaks
- number of leaks for 1-9
- 'X' if there are more leaks

This allows more rapid iteration: when bisecting, I don't need
to wait for the final report to see if the test still leaks.

Also, show the full result if there are any non-zero entries.
This shows negative entries, for the unfortunate cases where
a reference is created and cleaned up in different runs.

Test *failure* is still determined by the existing heuristic.