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

20 months agobpo-44865: Fix yet one missing translations in argparse (GH-27668)
Jérémie Detrey [Mon, 26 Feb 2024 22:05:01 +0000 (23:05 +0100)] 
bpo-44865: Fix yet one missing translations in argparse (GH-27668)

20 months agobpo-45101: Add consistency in usage message IO between 2 versions of python-config...
Kien Dang [Mon, 26 Feb 2024 20:04:44 +0000 (03:04 +0700)] 
bpo-45101: Add consistency in usage message IO between 2 versions of python-config (GH-28162)

On --help output to stdout.
On error output to stderr.

20 months agogh-77956: Add the words 'default' and 'version' help text localizable (GH-12711)
Emmanuel Arias [Mon, 26 Feb 2024 19:20:39 +0000 (16:20 -0300)] 
gh-77956: Add the words 'default' and 'version' help text  localizable (GH-12711)

Co-authored-by: paul.j3
Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
20 months agogh-115582: Make default PC/pyconfig.h work for free-threaded builds with manual ...
Steve Dower [Mon, 26 Feb 2024 19:14:14 +0000 (19:14 +0000)] 
gh-115582: Make default PC/pyconfig.h work for free-threaded builds with manual /DPy_GIL_DISABLED (GH-115850)

20 months agogh-113942: Show functions implemented as builtin methods (GH-115306)
Serhiy Storchaka [Mon, 26 Feb 2024 18:29:49 +0000 (20:29 +0200)] 
gh-113942: Show functions implemented as builtin methods (GH-115306)

Pydoc no longer skips global functions implemented as builtin methods,
such as MethodDescriptorType and WrapperDescriptorType.

20 months agogh-112006: Fix inspect.unwrap() for types where __wrapped__ is a data descriptor...
Serhiy Storchaka [Mon, 26 Feb 2024 18:07:41 +0000 (20:07 +0200)] 
gh-112006: Fix inspect.unwrap() for types where __wrapped__ is a data descriptor (GH-115540)

This also fixes inspect.Signature.from_callable() for builtins classmethod()
and staticmethod().

20 months agogh-115168: Add pystats counter for invalidated executors (GH-115169)
Michael Droettboom [Mon, 26 Feb 2024 17:51:47 +0000 (12:51 -0500)] 
gh-115168: Add pystats counter for invalidated executors (GH-115169)

20 months agogh-115882: Reference Unknwn.h for ctypes on Windows (GH-115350)
Yuriy Chernyshov [Mon, 26 Feb 2024 17:21:55 +0000 (18:21 +0100)] 
gh-115882: Reference Unknwn.h for ctypes on Windows (GH-115350)

This allows the module to be compiled with WIN32_LEAN_AND_MEAN enabled

20 months agoRename tier 2 redundancy eliminator to optimizer (#115888)
Guido van Rossum [Mon, 26 Feb 2024 16:42:53 +0000 (08:42 -0800)] 
Rename tier 2 redundancy eliminator to optimizer (#115888)

The original name is just too much of a mouthful.

20 months agoGH-115802: JIT "small" code for macOS and Linux (GH-115826)
Brandt Bucher [Mon, 26 Feb 2024 16:32:44 +0000 (08:32 -0800)] 
GH-115802: JIT "small" code for macOS and Linux (GH-115826)

20 months agoAdd Jason as an owner of configparser to coordinate backport concerns. (#115885)
Jason R. Coombs [Mon, 26 Feb 2024 16:11:38 +0000 (11:11 -0500)] 
Add Jason as an owner of configparser to coordinate backport concerns. (#115885)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
20 months agogh-113706: Update comment about long int representation (#113707)
Michael Droettboom [Mon, 26 Feb 2024 15:18:30 +0000 (10:18 -0500)] 
gh-113706: Update comment about long int representation (#113707)

20 months agogh-115823: Calculate correctly error locations when dealing with implicit encodings...
Pablo Galindo Salgado [Mon, 26 Feb 2024 12:57:09 +0000 (13:57 +0100)] 
gh-115823: Calculate correctly error locations when dealing with implicit encodings (#115824)

20 months agogh-115931: Fix `SyntaxWarning`s in `test_unparse` (#115935)
Nikita Sobolev [Mon, 26 Feb 2024 12:32:27 +0000 (15:32 +0300)] 
gh-115931: Fix `SyntaxWarning`s in `test_unparse` (#115935)

20 months agoDoc: Clarify the return type of Event.wait when timeout is used (GH-104168)
Phil Elson [Mon, 26 Feb 2024 09:53:20 +0000 (10:53 +0100)] 
Doc: Clarify the return type of Event.wait when timeout is used (GH-104168)

20 months agogh-115091: Remove a left-over sentence that refers to Py_OptimizeFlag from ctypes...
Antti Haapala [Mon, 26 Feb 2024 09:22:54 +0000 (11:22 +0200)] 
gh-115091: Remove a left-over sentence that refers to Py_OptimizeFlag from ctypes documentation (GH-115092)

Remove a left-over sentence that refers to Py_OptimizeFlag

Remove a left-over sentence that refers to an example that was present in Python 3.10 and was using ``Py_OptimizeFlag``.

20 months agogh-115881: Ensure `ast.parse()` parses conditional context managers even with low...
Alex Waygood [Mon, 26 Feb 2024 09:22:09 +0000 (09:22 +0000)] 
gh-115881: Ensure `ast.parse()` parses conditional context managers even with low `feature_version` passed (#115920)

20 months agogh-101100: Fix Sphinx warnings in `whatsnew/2.1.rst` (#112357)
Hugo van Kemenade [Mon, 26 Feb 2024 06:49:04 +0000 (08:49 +0200)] 
gh-101100: Fix Sphinx warnings in `whatsnew/2.1.rst` (#112357)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
20 months agogh-115921: Change 'equation' to 'expression' in random.rst (#115927)
Terry Jan Reedy [Mon, 26 Feb 2024 03:50:49 +0000 (22:50 -0500)] 
gh-115921: Change 'equation' to 'expression' in random.rst (#115927)

In uniform function entry.

20 months agogh-114099: Add configure and Makefile targets to support iOS compilation. (GH-115390)
Russell Keith-Magee [Mon, 26 Feb 2024 01:21:10 +0000 (09:21 +0800)] 
gh-114099: Add configure and Makefile targets to support iOS compilation. (GH-115390)

20 months agoGH-101112: Add "pattern language" section to pathlib docs (#114030)
Barney Gale [Mon, 26 Feb 2024 00:19:03 +0000 (00:19 +0000)] 
GH-101112: Add "pattern language" section to pathlib docs (#114030)

Explain the `full_match()` / `glob()` / `rglob()` pattern language in its own section. Move `rglob()` documentation under `glob()` and reduce duplicated text.

20 months agogh-71052: fix test_concurrent_futures wasi regression. (#115923)
Gregory P. Smith [Mon, 26 Feb 2024 00:02:56 +0000 (16:02 -0800)] 
gh-71052: fix test_concurrent_futures wasi regression. (#115923)

Fix the WASI test_concurrent_futures regression from #115917.

20 months agogh-115532: Add kernel density estimation to the statistics module (gh-115863)
Raymond Hettinger [Sun, 25 Feb 2024 23:46:47 +0000 (17:46 -0600)] 
gh-115532: Add kernel density estimation to the statistics module (gh-115863)

20 months agogh-115799: Add missing double-quote in docs (#115884)
bssyousefi [Sun, 25 Feb 2024 22:07:08 +0000 (17:07 -0500)] 
gh-115799: Add missing double-quote in docs (#115884)

20 months agogh-72249: Include the module name in the repr of partial object (GH-101910)
Furkan Onder [Sun, 25 Feb 2024 20:55:19 +0000 (23:55 +0300)] 
gh-72249: Include the module name in the repr of partial object (GH-101910)

Co-authored-by: Anilyka Barry <vgr255@live.ca>
20 months ago gh-115914: minor cleanup: simplify filename_obj assignment in PyRun_AnyFileExFlags...
Sergii K [Sun, 25 Feb 2024 20:45:38 +0000 (23:45 +0300)] 
 gh-115914: minor cleanup: simplify filename_obj assignment in PyRun_AnyFileExFlags (gh-115916)

This simplifies the code: less lines, easier to read. Logically equivalent, as any compiler likely already determined.

20 months agogh-101100: Fix broken xrefs in fcntl module doc (#115691)
Skip Montanaro [Sun, 25 Feb 2024 20:02:18 +0000 (14:02 -0600)] 
gh-101100: Fix broken xrefs in fcntl module doc (#115691)

* clean up fcntl module doc

* simplify

* a few changes, based on suggestion by CAM-Gerlach

* nitpick ignore for a couple other C functions mentioned in the fcntl module doc

* more changes, especially related to LOCK_* constants

* :data: back to :const:

* Apply suggestions from code review

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
---------

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
20 months agogh-71052: Enable test_concurrent_futures on platforms that lack multiprocessing ...
Malcolm Smith [Sun, 25 Feb 2024 19:38:18 +0000 (19:38 +0000)] 
gh-71052: Enable test_concurrent_futures on platforms that lack multiprocessing (gh-115917)

Enable test_concurrent_futures on platforms that support threading but not multiprocessing.

20 months agobpo-31116: Add Z85 variant to base64 (GH-30598)
Matan Perelman [Sun, 25 Feb 2024 17:17:54 +0000 (19:17 +0200)] 
bpo-31116: Add Z85 variant to base64 (GH-30598)

Z85  specification: https://rfc.zeromq.org/spec/32/

20 months agogh-96471: Correct docs for queue shutdown (#115838)
Laurie O [Sun, 25 Feb 2024 16:53:21 +0000 (02:53 +1000)] 
gh-96471: Correct docs for queue shutdown (#115838)

20 months agogh-113479: Link to workaround for subtle issue with takewhile() (gh-115890)
Raymond Hettinger [Sun, 25 Feb 2024 12:32:14 +0000 (06:32 -0600)] 
gh-113479: Link to workaround for subtle issue with takewhile() (gh-115890)

20 months agogh-103417: Fix the scheduler example (GH-111497)
mauricelambert [Sun, 25 Feb 2024 11:55:57 +0000 (11:55 +0000)] 
gh-103417: Fix the scheduler example (GH-111497)

Arguments to enterabs() are specified as Unix time.
If the scheduler use the time.monotonic timer, the code will take
decades to complete.