]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
16 months agogh-120858: PyDict_Next should not lock the dict (#120859)
Sam Gross [Mon, 24 Jun 2024 18:15:15 +0000 (14:15 -0400)] 
gh-120858: PyDict_Next should not lock the dict (#120859)

PyDict_Next no longer locks the dictionary in the free-threaded build. Locking
around individual PyDict_Next calls is not sufficient because the function
returns borrowed references and because it allows concurrent modifications
during the iteraiton loop.

The internal locking also interferes with correct external synchronization
because it may suspend outer critical sections created by the caller.

16 months agogh-120860: Fix a few bugs in `type_setattro` error paths. (#120861)
Sam Gross [Mon, 24 Jun 2024 18:08:23 +0000 (14:08 -0400)] 
gh-120860: Fix a few bugs in `type_setattro` error paths. (#120861)

Moves the logic to update the type's dictionary to its own function in order
to make the lock scoping more clear.

Also, ensure that `name` is decref'd on the error path.

16 months agoFix typos in comments (#120821)
Xie Yanbo [Mon, 24 Jun 2024 17:47:00 +0000 (01:47 +0800)] 
Fix typos in comments (#120821)

16 months agogh-120834: fix over-allocation in PyGenObject, PyCoroObject, PyAsyncGenObject. (...
Irit Katriel [Mon, 24 Jun 2024 17:41:53 +0000 (18:41 +0100)] 
gh-120834: fix over-allocation in PyGenObject, PyCoroObject, PyAsyncGenObject. (#120941)

16 months agogh-120956: Avoid comparison of int to Py_ssize_t in parser (#120959)
Lysandros Nikolaou [Mon, 24 Jun 2024 16:13:02 +0000 (18:13 +0200)] 
gh-120956: Avoid comparison of int to Py_ssize_t in parser (#120959)

16 months agoFixes loop variables to be the same types as their limit (GH-120958)
Steve Dower [Mon, 24 Jun 2024 16:11:47 +0000 (17:11 +0100)] 
Fixes loop variables to be the same types as their limit (GH-120958)

16 months agogh-119182: Add PyUnicodeWriter_WriteUCS4() function (#120849)
Victor Stinner [Mon, 24 Jun 2024 15:40:39 +0000 (17:40 +0200)] 
gh-119182: Add PyUnicodeWriter_WriteUCS4() function (#120849)

16 months agoGH-117062: Make _JUMP_TO_TOP a general absolute jump (GH-120854)
Brandt Bucher [Mon, 24 Jun 2024 15:35:10 +0000 (08:35 -0700)] 
GH-117062: Make _JUMP_TO_TOP a general absolute jump (GH-120854)

16 months agogh-119521: Use `PyAPI_DATA`, not `extern`, for `_PyExc_IncompleteInputError` (GH...
Petr Viktorin [Mon, 24 Jun 2024 15:30:29 +0000 (17:30 +0200)] 
gh-119521: Use `PyAPI_DATA`, not `extern`, for `_PyExc_IncompleteInputError` (GH-120955)

16 months agogh-70278: Fix PyUnicode_FromFormat() with precision for %s and %V (GH-120365)
Serhiy Storchaka [Mon, 24 Jun 2024 15:07:07 +0000 (18:07 +0300)] 
gh-70278: Fix PyUnicode_FromFormat() with precision for %s and %V (GH-120365)

PyUnicode_FromFormat() no longer produces the ending \ufffd
character for truncated C string when use precision with %s and %V.
It now truncates the string before the start of truncated multibyte sequences.

16 months agodocs: puremagic.what() as replacement for imghdr.what() (#120871)
Christian Clauss [Mon, 24 Jun 2024 13:32:13 +0000 (15:32 +0200)] 
docs: puremagic.what() as replacement for imghdr.what() (#120871)

16 months agogh-120373: Mark test_audit.test_http as requiring the network resource (#120374)
Itamar Oren [Mon, 24 Jun 2024 13:18:46 +0000 (06:18 -0700)] 
gh-120373: Mark test_audit.test_http as requiring the network resource (#120374)

16 months agogh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from publi...
Pablo Galindo Salgado [Mon, 24 Jun 2024 12:08:12 +0000 (13:08 +0100)] 
gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
16 months agogh-120834: fix type of *_iframe field in _PyGenObject_HEAD declaration (#120835)
Irit Katriel [Mon, 24 Jun 2024 09:23:38 +0000 (10:23 +0100)] 
gh-120834: fix type of *_iframe field in _PyGenObject_HEAD declaration (#120835)

16 months agogh-119614: Fix truncation of strings with embedded null characters in Tkinter (GH...
Serhiy Storchaka [Mon, 24 Jun 2024 09:17:25 +0000 (12:17 +0300)] 
gh-119614: Fix truncation of strings with embedded null characters in Tkinter (GH-120909)

Now the null character is always represented as \xc0\x80 for
Tcl_NewStringObj().

16 months agogh-112169: Documented getaddrinfo/getnameinfo default loop executor usage and implica...
Alek Kowalczyk [Mon, 24 Jun 2024 08:35:02 +0000 (10:35 +0200)] 
gh-112169: Documented getaddrinfo/getnameinfo default loop executor usage and implications. (#112191)

Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
16 months agogh-120683: Fix an error in logging.LogRecord timestamp (GH-120709)
Serhiy Storchaka [Mon, 24 Jun 2024 06:50:39 +0000 (09:50 +0300)] 
gh-120683: Fix an error in logging.LogRecord timestamp (GH-120709)

The integer part of the timestamp can be rounded up, while the millisecond
calculation truncates, causing the log timestamp to be wrong by up to 999 ms
(affected roughly 1 in 8 million timestamps).

16 months agoUse _PyLong_IsNegative instead of _PyLong_Sign if appropriate. (GH-120493)
Serhiy Storchaka [Mon, 24 Jun 2024 06:49:01 +0000 (09:49 +0300)] 
Use _PyLong_IsNegative instead of _PyLong_Sign if appropriate. (GH-120493)

It is faster and more obvious.

16 months agoGH-73991: Add `pathlib.Path.copytree()` (#120718)
Barney Gale [Sun, 23 Jun 2024 21:01:12 +0000 (22:01 +0100)] 
GH-73991: Add `pathlib.Path.copytree()` (#120718)

Add `pathlib.Path.copytree()` method, which recursively copies one
directory to another.

This differs from `shutil.copytree()` in the following respects:

1. Our method has a *follow_symlinks* argument, whereas shutil's has a
   *symlinks* argument with an inverted meaning.
2. Our method lacks something like a *copy_function* argument. It always
   uses `Path.copy()` to copy files.
3. Our method lacks something like a *ignore_dangling_symlinks* argument.
   Instead, users can filter out danging symlinks with *ignore*, or
   ignore exceptions with *on_error*
4. Our *ignore* argument is a callable that accepts a single path object,
   whereas shutil's accepts a path and a list of child filenames.
5. We add an *on_error* argument, which is a callable that accepts
   an `OSError` instance. (`Path.walk()` also accepts such a callable).

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
16 months agoDocs makefile/RTD: Use uv if installed (#120711)
Hugo van Kemenade [Sun, 23 Jun 2024 19:23:27 +0000 (13:23 -0600)] 
Docs makefile/RTD: Use uv if installed (#120711)

16 months agogh-120910: Fix issue resolving relative paths outside site-packages. (#120911)
Jason R. Coombs [Sun, 23 Jun 2024 17:06:07 +0000 (13:06 -0400)] 
gh-120910: Fix issue resolving relative paths outside site-packages. (#120911)

Incorporates changes from importlib_metadata 7.2.1.

16 months agoTyping docs: normalize some indents in code examples (#120912)
Nyakku Shigure [Sun, 23 Jun 2024 16:15:12 +0000 (00:15 +0800)] 
Typing docs: normalize some indents in code examples (#120912)

16 months agogh-101830: Fix Tcl_Obj to string conversion (GH-120884)
Serhiy Storchaka [Sun, 23 Jun 2024 13:34:14 +0000 (16:34 +0300)] 
gh-101830: Fix Tcl_Obj to string conversion (GH-120884)

Accessing the Tkinter object's string representation no longer converts
the underlying Tcl object to a string on Windows.

16 months agoGH-120804: add docs for removal for asyncio child watchers (#120895)
Kumar Aditya [Sun, 23 Jun 2024 13:14:12 +0000 (18:44 +0530)] 
GH-120804: add docs for removal for asyncio child watchers (#120895)

Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
16 months agoGH-120804: Remove `PidfdChildWatcher`, `ThreadedChildWatcher` and `AbstractChildWatch...
Kumar Aditya [Sun, 23 Jun 2024 13:08:50 +0000 (18:38 +0530)] 
GH-120804: Remove `PidfdChildWatcher`, `ThreadedChildWatcher` and `AbstractChildWatcher` from asyncio APIs (#120893)

16 months agogh-120896: Fix typo in version changed note of `urllib.parse.urlparse()` (#120898)
Nice Zombies [Sun, 23 Jun 2024 12:30:23 +0000 (14:30 +0200)] 
gh-120896: Fix typo in version changed note of `urllib.parse.urlparse()` (#120898)

16 months agoGH-120804: Remove `get_child_watcher` and `set_child_watcher` from asyncio (#120818)
Kumar Aditya [Sun, 23 Jun 2024 04:23:23 +0000 (09:53 +0530)] 
GH-120804: Remove `get_child_watcher` and `set_child_watcher` from asyncio (#120818)

16 months agoGH-107803: double linked list implementation for asyncio tasks (GH-107804)
Kumar Aditya [Sat, 22 Jun 2024 17:58:35 +0000 (23:28 +0530)] 
GH-107803: double linked list implementation for asyncio tasks (GH-107804)

* linked list

* add tail optmiization to linked list

* wip

* wip

* wip

* more fixes

* finally it works

* add tests

* remove weakreflist

* add some comments

* reduce code duplication in _asynciomodule.c

* address some review comments

* add invariants about the state of the linked list

* add better explanation

* clinic regen

* reorder branches for better branch prediction

* Update Modules/_asynciomodule.c

* Apply suggestions from code review

Co-authored-by: Itamar Oren <itamarost@gmail.com>
* fix capturing of eager tasks

* add comment to task finalization

* fix tests and couple c implmentation to c task

improved linked-list logic and more comments

* fix test

---------

Co-authored-by: Itamar Oren <itamarost@gmail.com>
16 months agogh-119182: Add checks to PyUnicodeWriter APIs (#120870)
Victor Stinner [Sat, 22 Jun 2024 15:25:55 +0000 (17:25 +0200)] 
gh-119182: Add checks to PyUnicodeWriter APIs (#120870)

16 months agogh-120873: Add tests for new widget options in Tk 8.7 (GH-120877)
Serhiy Storchaka [Sat, 22 Jun 2024 13:19:42 +0000 (16:19 +0300)] 
gh-120873: Add tests for new widget options in Tk 8.7 (GH-120877)

16 months agogh-120873: Add test for "state" option in ttk.Scale (GH-120874)
Serhiy Storchaka [Sat, 22 Jun 2024 11:18:04 +0000 (14:18 +0300)] 
gh-120873: Add test for "state" option in ttk.Scale (GH-120874)

Also refactor the "state" option tests for other ttk widgets.

16 months agogh-119182: Use PyUnicodeWriter_WriteWideChar() (#120851)
Victor Stinner [Sat, 22 Jun 2024 06:58:22 +0000 (08:58 +0200)] 
gh-119182: Use PyUnicodeWriter_WriteWideChar() (#120851)

Use PyUnicodeWriter_WriteWideChar() in PyUnicode_FromFormat()

16 months agogh-104855: Update Tkinter tests for Tcl/Tk 8.7 and 9.0 (GH-120824)
Serhiy Storchaka [Sat, 22 Jun 2024 06:53:24 +0000 (09:53 +0300)] 
gh-104855: Update Tkinter tests for Tcl/Tk 8.7 and 9.0 (GH-120824)

The tests are now passed with the current version of Tcl/Tk under
development (8.7b1+ and 9.0b3+).

The following changes were also made to make the tests more flexible:

* Helper methods like checkParam() now interpret the expected error message
  as a regular expression instead of a literal.
* Add support of new arguments in checkEnumParam():
  - allow_empty=True skips testing with empty string;
  - fullname= specifies the name for error message if it differs from the
    option name;
  - sort=True sorts values for error message.
* Add support of the allow_empty argument in checkReliefParam():
  allow_empty=True adds an empty string to the list of accepted values.
* Attributes _clip_highlightthickness, _clip_pad and  _clip_borderwidth
  specify how negative values of options -highlightthickness, -padx, -pady
  and -borderwidth are handled.
* Use global variables for some common error messages.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
16 months agogh-119344: Make critical section API public (#119353)
Sam Gross [Fri, 21 Jun 2024 19:50:18 +0000 (15:50 -0400)] 
gh-119344: Make critical section API public (#119353)

This makes the following macros public as part of the non-limited C-API for
locking a single object or two objects at once.

* `Py_BEGIN_CRITICAL_SECTION(op)` / `Py_END_CRITICAL_SECTION()`
* `Py_BEGIN_CRITICAL_SECTION2(a, b)` / `Py_END_CRITICAL_SECTION2()`

The supporting functions and structs used by the macros are also exposed for
cases where C macros are not available.

16 months agogh-120838: Add a Note in the Docs About Expectations for Py_Finalize() (gh-120839)
Eric Snow [Fri, 21 Jun 2024 19:05:53 +0000 (13:05 -0600)] 
gh-120838: Add a Note in the Docs About Expectations for Py_Finalize() (gh-120839)

16 months agogh-119003: Clarify slice assignments (#119935)
Nice Zombies [Fri, 21 Jun 2024 18:30:50 +0000 (20:30 +0200)] 
gh-119003: Clarify slice assignments (#119935)

16 months agoAmend categories of @nineteendo's news entries (#120735)
Nice Zombies [Fri, 21 Jun 2024 18:20:13 +0000 (20:20 +0200)] 
Amend categories of @nineteendo's news entries (#120735)

16 months agogh-119182: Rewrite PyUnicodeWriter tests in Python (#120845)
Victor Stinner [Fri, 21 Jun 2024 18:15:06 +0000 (20:15 +0200)] 
gh-119182: Rewrite PyUnicodeWriter tests in Python (#120845)

16 months agogh-119182: Add PyUnicodeWriter_DecodeUTF8Stateful() (#120639)
Victor Stinner [Fri, 21 Jun 2024 17:33:15 +0000 (19:33 +0200)] 
gh-119182: Add PyUnicodeWriter_DecodeUTF8Stateful() (#120639)

Add PyUnicodeWriter_WriteWideChar() and
PyUnicodeWriter_DecodeUTF8Stateful() functions.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
16 months agogh-120811: Fix reference leak upon `_PyContext_Exit` failure (#120812)
Peter [Fri, 21 Jun 2024 17:28:19 +0000 (12:28 -0500)] 
gh-120811: Fix reference leak upon `_PyContext_Exit` failure (#120812)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
16 months agogh-120782: Update internal type cache when reloading datetime (#120829)
neonene [Fri, 21 Jun 2024 17:09:33 +0000 (02:09 +0900)] 
gh-120782: Update internal type cache when reloading datetime (#120829)

16 months agogh-113993: Allow interned strings to be mortal, and fix related issues (GH-120520)
Petr Viktorin [Fri, 21 Jun 2024 15:19:31 +0000 (17:19 +0200)] 
gh-113993: Allow interned strings to be mortal, and fix related issues (GH-120520)

* Add an InternalDocs file describing how interning should work and how to use it.

* Add internal functions to *explicitly* request what kind of interning is done:
  - `_PyUnicode_InternMortal`
  - `_PyUnicode_InternImmortal`
  - `_PyUnicode_InternStatic`

* Switch uses of `PyUnicode_InternInPlace` to those.

* Disallow using `_Py_SetImmortal` on strings directly.
  You should use `_PyUnicode_InternImmortal` instead:
  - Strings should be interned before immortalization, otherwise you're possibly
    interning a immortalizing copy.
  - `_Py_SetImmortal` doesn't handle the `SSTATE_INTERNED_MORTAL` to
    `SSTATE_INTERNED_IMMORTAL` update, and those flags can't be changed in
    backports, as they are now part of public API and version-specific ABI.

* Add private `_only_immortal` argument for `sys.getunicodeinternedsize`, used in refleak test machinery.

* Make sure the statically allocated string singletons are unique. This means these sets are now disjoint:
  - `_Py_ID`
  - `_Py_STR` (including the empty string)
  - one-character latin-1 singletons

  Now, when you intern a singleton, that exact singleton will be interned.

* Add a `_Py_LATIN1_CHR` macro, use it instead of `_Py_ID`/`_Py_STR` for one-character latin-1 singletons everywhere (including Clinic).

* Intern `_Py_STR` singletons at startup.

* For free-threaded builds, intern `_Py_LATIN1_CHR` singletons at startup.

* Beef up the tests. Cover internal details (marked with `@cpython_only`).

* Add lots of assertions

Co-Authored-By: Eric Snow <ericsnowcurrently@gmail.com>
16 months agogh-120380: fix Python implementation of `pickle.Pickler` for `bytes` and `bytearray...
Bénédikt Tran [Fri, 21 Jun 2024 12:22:38 +0000 (14:22 +0200)] 
gh-120380: fix Python implementation of `pickle.Pickler` for `bytes` and `bytearray` objects in protocol version 5. (GH-120422)

16 months agogh-120773: document introspective attributes of an async generator object in the...
blhsing [Fri, 21 Jun 2024 10:55:36 +0000 (18:55 +0800)] 
gh-120773: document introspective attributes of an async generator object in the inspect module (#120778)

16 months agogh-120384: Fix array-out-of-bounds crash in `list_ass_subscript` (#120442)
Nikita Sobolev [Fri, 21 Jun 2024 10:48:38 +0000 (13:48 +0300)] 
gh-120384: Fix array-out-of-bounds crash in `list_ass_subscript` (#120442)

16 months agoGH-120804: Remove SafeChildWatcher, FastChildWatcher and MultiLoopChildWatcher from...
Kumar Aditya [Fri, 21 Jun 2024 04:53:10 +0000 (10:23 +0530)] 
GH-120804: Remove SafeChildWatcher, FastChildWatcher and MultiLoopChildWatcher from asyncio (#120805)

Remove SafeChildWatcher, FastChildWatcher and MultiLoopChildWatcher from asyncio. These child watchers have been deprecated since Python 3.12. The tests are also removed and some more tests will be added after the rewrite of child watchers.

16 months agogh-111259: Document idiomatic RE pattern (?s:.) that matches any character (GH-120745)
Serhiy Storchaka [Thu, 20 Jun 2024 21:03:49 +0000 (00:03 +0300)] 
gh-111259: Document idiomatic RE pattern (?s:.) that matches any character (GH-120745)

16 months agogh-119182: Use public PyUnicodeWriter in contextvar_tp_repr() (#120809)
Victor Stinner [Thu, 20 Jun 2024 19:56:47 +0000 (21:56 +0200)] 
gh-119182: Use public PyUnicodeWriter in contextvar_tp_repr() (#120809)

The public PyUnicodeWriter API enables overallocation by default and
so is more efficient. It also makes the code simpler and shorter.

16 months agogh-119182: Optimize PyUnicode_FromFormat() (#120796)
Victor Stinner [Thu, 20 Jun 2024 19:06:16 +0000 (21:06 +0200)] 
gh-119182: Optimize PyUnicode_FromFormat() (#120796)

Use strchr() and ucs1lib_find_max_char() to optimize the code path
formatting sub-strings between '%' formats.

16 months agogh-120801: Refactor importlib.metadata fixtures. (#120803)
Jason R. Coombs [Thu, 20 Jun 2024 19:00:39 +0000 (15:00 -0400)] 
gh-120801: Refactor importlib.metadata fixtures. (#120803)

These changes released with importlib_metadata 7.2.0.

16 months agogh-119182: Use public PyUnicodeWriter API in union_repr() (#120797)
Victor Stinner [Thu, 20 Jun 2024 18:39:34 +0000 (20:39 +0200)] 
gh-119182: Use public PyUnicodeWriter API in union_repr() (#120797)

The public PyUnicodeWriter API enables overallocation by default and
so is more efficient.

Benchmark:

python -m pyperf timeit \
    -s 't = int | float | complex | str | bytes | bytearray' \
       ' | memoryview | list | dict' \
    'str(t)'

Result:

1.29 us +- 0.02 us -> 1.00 us +- 0.02 us: 1.29x faster

16 months agogh-119182: Use public PyUnicodeWriter API in ga_repr() (#120799)
Victor Stinner [Thu, 20 Jun 2024 18:35:35 +0000 (20:35 +0200)] 
gh-119182: Use public PyUnicodeWriter API in ga_repr() (#120799)

The public PyUnicodeWriter API enables overallocation by default and
so is more efficient.

Benchmark:

python -m pyperf timeit \
    -s 't = list[int, float, complex, str, bytes, bytearray, ' \
                 'memoryview, list, dict]' \
    'str(t)'

Result:

1.49 us +- 0.03 us -> 1.10 us +- 0.02 us: 1.35x faster

16 months agogh-120769: Add pdb meta command to print frame status. (#120770)
Tian Gao [Thu, 20 Jun 2024 17:38:07 +0000 (10:38 -0700)] 
gh-120769: Add pdb meta command to print frame status. (#120770)

16 months agogh-117511: Make PyMutex public in the non-limited API (#117731)
Sam Gross [Thu, 20 Jun 2024 15:29:08 +0000 (11:29 -0400)] 
gh-117511: Make PyMutex public in the non-limited API (#117731)

16 months agogh-120780: Show attribute name for LOAD_SPECIAL in dis output (#120781)
Jelle Zijlstra [Thu, 20 Jun 2024 14:07:24 +0000 (07:07 -0700)] 
gh-120780: Show attribute name for LOAD_SPECIAL in dis output (#120781)

16 months agogh-98442: fix locations of with statement's cleanup instructions (#120763)
Irit Katriel [Thu, 20 Jun 2024 08:32:06 +0000 (09:32 +0100)] 
gh-98442: fix locations of with statement's cleanup instructions (#120763)

gh-98442: fix location of with statement's cleanup instructions

16 months agogh-111259: Optimize complementary character sets in RE (GH-120742)
Serhiy Storchaka [Thu, 20 Jun 2024 07:19:32 +0000 (10:19 +0300)] 
gh-111259: Optimize complementary character sets in RE (GH-120742)

Patterns like "[\s\S]" or "\s|\S" which match any character are now compiled
to the same effective code as a dot with the DOTALL modifier ("(?s:.)").

16 months agogh-119698: symtable: Fix merge race (#120779)
Jelle Zijlstra [Thu, 20 Jun 2024 05:42:30 +0000 (22:42 -0700)] 
gh-119698: symtable: Fix merge race (#120779)

16 months agogh-119698: fix `symtable.Class.get_methods` and document its behaviour correctly...
Bénédikt Tran [Thu, 20 Jun 2024 03:49:30 +0000 (05:49 +0200)] 
gh-119698: fix `symtable.Class.get_methods` and document its behaviour correctly (#120151)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
16 months agoFix typos in comments (#120481)
Xie Yanbo [Thu, 20 Jun 2024 03:16:14 +0000 (11:16 +0800)] 
Fix typos in comments (#120481)

16 months agoGH-120602: Support LLVM_VERSION_SUFFIX for JIT builds (GH-120604)
Xarblu [Thu, 20 Jun 2024 00:48:00 +0000 (02:48 +0200)] 
GH-120602: Support LLVM_VERSION_SUFFIX for JIT builds (GH-120604)

16 months agogh-120606: Allow EOF to exit pdb commands definition (#120607)
Tian Gao [Wed, 19 Jun 2024 22:50:26 +0000 (15:50 -0700)] 
gh-120606: Allow EOF to exit pdb commands definition (#120607)

16 months agogh-120732: Fix `name` passing to `Mock`, when using kwargs to `create_autospec` ...
Nikita Sobolev [Wed, 19 Jun 2024 20:35:11 +0000 (23:35 +0300)] 
gh-120732: Fix `name` passing to `Mock`, when using kwargs to `create_autospec` (#120737)

16 months agogh-118820: Zero-valued flag enum has no name (GH-118848)
Nice Zombies [Wed, 19 Jun 2024 20:09:53 +0000 (22:09 +0200)] 
gh-118820: Zero-valued flag enum has no name (GH-118848)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
16 months agoRegen ``Doc/requirements-oldest-sphinx.txt`` (#120753)
Kirill Podoprigora [Wed, 19 Jun 2024 19:21:12 +0000 (22:21 +0300)] 
Regen ``Doc/requirements-oldest-sphinx.txt`` (#120753)

16 months agogh-120521: clarify except* documentation to allow tuples (#120523)
Danny Yang [Wed, 19 Jun 2024 18:49:00 +0000 (14:49 -0400)] 
gh-120521: clarify except* documentation to allow tuples (#120523)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
16 months agogh-119786: move locations doc to InternalDocs (#120445)
Irit Katriel [Wed, 19 Jun 2024 16:58:54 +0000 (17:58 +0100)] 
gh-119786: move locations doc to InternalDocs (#120445)

16 months agoGH-120097: Make FrameLocalsProxy a mapping (#120101)
Mark Shannon [Wed, 19 Jun 2024 16:54:13 +0000 (17:54 +0100)] 
GH-120097: Make FrameLocalsProxy a mapping (#120101)

* Register FrameLocalsProxy as a subclass of collections.abc.Mapping

* Allow FrameLocalsProxy to matching mapping patterns

16 months agoGH-119462: Enforce invariants of type versioning (GH-120731)
Mark Shannon [Wed, 19 Jun 2024 16:38:45 +0000 (17:38 +0100)] 
GH-119462: Enforce invariants of type versioning (GH-120731)

* Remove uses of Py_TPFLAGS_VALID_VERSION_TAG

16 months agogh-120437: Fix `_CHECK_STACK_SPACE` optimization problems introduced in gh-118322...
Nadeshiko Manju [Wed, 19 Jun 2024 15:34:39 +0000 (23:34 +0800)] 
gh-120437: Fix `_CHECK_STACK_SPACE` optimization problems introduced in gh-118322 (GH-120712)

Co-authored-by: Ken Jin <kenjin4096@gmail.com>
16 months agoFix types in pegen parser generator (GH-120720)
yf-yang [Wed, 19 Jun 2024 14:12:40 +0000 (22:12 +0800)] 
Fix types in pegen parser generator (GH-120720)

16 months agogh-120733: rename internal compiler functions according to naming convention (#120734)
Irit Katriel [Wed, 19 Jun 2024 13:19:59 +0000 (14:19 +0100)] 
gh-120733: rename internal compiler functions according to naming convention (#120734)

16 months agogh-120635: Avoid leaking processes in test_pyrepl (#120676)
Victor Stinner [Wed, 19 Jun 2024 13:14:29 +0000 (15:14 +0200)] 
gh-120635: Avoid leaking processes in test_pyrepl (#120676)

If the child process takes longer than SHORT_TIMEOUT seconds to
complete, kill the process but then wait until it completes with no
timeout to not leak child processes.

16 months agogh-120722: Set position on RETURN_VALUE in lambda (#120724)
Jelle Zijlstra [Wed, 19 Jun 2024 12:56:36 +0000 (05:56 -0700)] 
gh-120722: Set position on RETURN_VALUE in lambda (#120724)

16 months agogh-119960: Add information about regex flags in re module functions (#119978)
Awbert [Wed, 19 Jun 2024 09:42:01 +0000 (12:42 +0300)] 
gh-119960: Add information about regex flags in re module functions (#119978)

16 months agogh-102797: Add more code snippets in test_ast (#102798)
Kirill Podoprigora [Wed, 19 Jun 2024 07:51:43 +0000 (10:51 +0300)] 
gh-102797: Add more code snippets in test_ast (#102798)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Nineteendo <nineteendo19d0@gmail.com>
16 months agogh-120726: Fix compiler warnings on is_core_module() (#120727)
Kirill Podoprigora [Wed, 19 Jun 2024 07:46:04 +0000 (10:46 +0300)] 
gh-120726: Fix compiler warnings on is_core_module() (#120727)

Fix compiler warnings on is_core_module() and
check_interpreter_whence(): only define them when
assertions are built.

16 months agoAdd a link to free-threading HOWTO to the index (follow-up to GH-119366) (GH-120703)
Petr Viktorin [Wed, 19 Jun 2024 07:17:26 +0000 (09:17 +0200)] 
Add a link to free-threading HOWTO to the index (follow-up to GH-119366) (GH-120703)

16 months agogh-120633: Move scrollbar and remove tear-off menus in turtledemo (#120634)
Wulian233 [Wed, 19 Jun 2024 06:20:54 +0000 (14:20 +0800)] 
gh-120633: Move scrollbar and remove tear-off menus in turtledemo (#120634)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
16 months agoGH-119726: Deduplicate JIT trampolines for out-of-range jumps (GH-120250)
Diego Russo [Wed, 19 Jun 2024 01:27:02 +0000 (02:27 +0100)] 
GH-119726: Deduplicate JIT trampolines for out-of-range jumps (GH-120250)

16 months agoIgnore some failing tests in emulated JIT CI (GH-120375)
Diego Russo [Wed, 19 Jun 2024 01:24:29 +0000 (02:24 +0100)] 
Ignore some failing tests in emulated JIT CI (GH-120375)

16 months agoGH-73991: Add follow_symlinks argument to `pathlib.Path.copy()` (#120519)
Barney Gale [Wed, 19 Jun 2024 00:59:54 +0000 (01:59 +0100)] 
GH-73991: Add follow_symlinks argument to `pathlib.Path.copy()` (#120519)

Add support for not following symlinks in `pathlib.Path.copy()`.

On Windows we add the `COPY_FILE_COPY_SYMLINK` flag is following symlinks is disabled. If the source is symlink to a directory, this call will fail with `ERROR_ACCESS_DENIED`. In this case we add `COPY_FILE_DIRECTORY` to the flags and retry. This can fail on old Windowses, which we note in the docs.

No news as `copy()` was only just added.

16 months agoGH-73991: pathlib ABC tests: add `DummyPath.unlink()` and `rmdir()` (#120715)
Barney Gale [Tue, 18 Jun 2024 22:13:45 +0000 (23:13 +0100)] 
GH-73991: pathlib ABC tests: add `DummyPath.unlink()` and `rmdir()` (#120715)

In preparation for the addition of `PathBase.rmtree()`, implement
`DummyPath.unlink()` and `rmdir()`, and move corresponding tests into
`test_pathlib_abc` so they're run against `DummyPath`.

16 months agogh-120367: fix bug where compiler detects redundant jump after pseudo op replacement...
Irit Katriel [Tue, 18 Jun 2024 22:09:23 +0000 (23:09 +0100)] 
gh-120367: fix bug where compiler detects redundant jump after pseudo op replacement (#120714)

16 months agoGH-73991: Use same signature for `shutil._rmtree_[un]safe()`. (#120517)
Barney Gale [Tue, 18 Jun 2024 21:15:18 +0000 (22:15 +0100)] 
GH-73991: Use same signature for `shutil._rmtree_[un]safe()`. (#120517)

Preparatory work for moving `_rmtree_unsafe()` and `_rmtree_safe_fd()` to
`pathlib._os` so that they can be used from both `shutil` and `pathlib`.

Move implementation-specific setup from `rmtree()` into the safe/unsafe
functions, and give them the same signature `(path, dir_fd, onexc)`.

In the tests, mock `os.open` rather than `_rmtree_safe_fd()` to ensure the
FD-based walk is used, and replace a couple references to
`shutil._use_fd_functions` with `shutil.rmtree.avoids_symlink_attacks`
(which has the same value).

No change of behaviour.

16 months agogh-120688: Build WASI with -O3 in debug mode (#120691)
Victor Stinner [Tue, 18 Jun 2024 17:35:44 +0000 (19:35 +0200)] 
gh-120688: Build WASI with -O3 in debug mode (#120691)

On WASI in debug mode, Python is now built with compiler flag -O3
instead of -Og, to support more recursive calls.

16 months agogh-119574: Add some missing environment variables to '--help-env'. (GH-120006)
devdanzin [Tue, 18 Jun 2024 17:12:58 +0000 (14:12 -0300)] 
gh-119574: Add some missing environment variables to '--help-env'. (GH-120006)

16 months agogh-120417: Add #noqa: F401 to tests (#120627)
Victor Stinner [Tue, 18 Jun 2024 15:51:47 +0000 (17:51 +0200)] 
gh-120417: Add #noqa: F401 to tests (#120627)

Ignore linter "imported but unused" warnings in tests when the linter
doesn't understand how the import is used.

16 months agogh-120496: Add a note about iterator thread-safe (gh-120685)
Donghee Na [Tue, 18 Jun 2024 15:37:34 +0000 (00:37 +0900)] 
gh-120496: Add a note about iterator thread-safe (gh-120685)

16 months agogh-117953: Skip `test_interpreters` properly without GIL (#120689)
Nice Zombies [Tue, 18 Jun 2024 15:22:24 +0000 (17:22 +0200)] 
gh-117953: Skip `test_interpreters` properly without GIL (#120689)

16 months agogh-120417: Use import_helper() in test_regrtest (#120680)
Victor Stinner [Tue, 18 Jun 2024 15:15:04 +0000 (17:15 +0200)] 
gh-120417: Use import_helper() in test_regrtest (#120680)

16 months agogh-120449: fix ``test_pyclbr`` introspection for mangled names (GH-120450)
Bénédikt Tran [Tue, 18 Jun 2024 14:29:43 +0000 (16:29 +0200)] 
gh-120449: fix ``test_pyclbr`` introspection for mangled names (GH-120450)

16 months agogh-120600: Make Py_TYPE() opaque in limited C API 3.14 (#120601)
Victor Stinner [Tue, 18 Jun 2024 14:28:48 +0000 (16:28 +0200)] 
gh-120600: Make Py_TYPE() opaque in limited C API 3.14 (#120601)

In the limited C API 3.14 and newer, Py_TYPE() is now implemented as
an opaque function call to hide implementation details.

16 months agogh-118789: Add `PyUnstable_Object_ClearWeakRefsNoCallbacks` (#118807)
Sam Gross [Tue, 18 Jun 2024 13:57:23 +0000 (09:57 -0400)] 
gh-118789: Add `PyUnstable_Object_ClearWeakRefsNoCallbacks` (#118807)

This exposes `PyUnstable_Object_ClearWeakRefsNoCallbacks` as an unstable
C-API function to provide a thread-safe mechanism for clearing weakrefs
without executing callbacks.

Some C-API extensions need to clear weakrefs without calling callbacks,
such as after running finalizers like we do in subtype_dealloc.
Previously they could use `_PyWeakref_ClearRef` on each weakref, but
that's not thread-safe in the free-threaded build.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
16 months agogh-120659: Skip `test_freethreading` with GIL (#120660)
Nice Zombies [Tue, 18 Jun 2024 13:56:20 +0000 (15:56 +0200)] 
gh-120659: Skip `test_freethreading` with GIL (#120660)

16 months agogh-120417: Move imports to doctests in test_doctest (#120679)
Victor Stinner [Tue, 18 Jun 2024 13:54:53 +0000 (15:54 +0200)] 
gh-120417: Move imports to doctests in test_doctest (#120679)

16 months agogh-119241: Add HOWTO for free-threaded C API extensions (#119877)
Sam Gross [Tue, 18 Jun 2024 13:49:51 +0000 (09:49 -0400)] 
gh-119241: Add HOWTO for free-threaded C API extensions (#119877)

Some sections adapted from https://github.com/Quansight-Labs/free-threaded-compatibility/
written by Nathan Goldbaum.

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
16 months agogh-120381: Fix inspect.ismethoddescriptor() (#120383)
Jan Kaliszewski [Tue, 18 Jun 2024 12:19:43 +0000 (14:19 +0200)] 
gh-120381: Fix inspect.ismethoddescriptor() (#120383)

The `inspect.ismethoddescriptor()` function did not check for the lack of
`__delete__()` and, consequently, erroneously returned True when applied
to *data* descriptors with only `__get__()` and `__delete__()` defined.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
16 months agogh-120674: Protect multi-line macros in _testbuffer.c and _testcapimodule.c (#120675)
Bénédikt Tran [Tue, 18 Jun 2024 12:04:52 +0000 (14:04 +0200)] 
gh-120674: Protect multi-line macros in _testbuffer.c and _testcapimodule.c (#120675)

Add do { ... } while (0) pattern.

16 months agogh-120662: Improve `smtplib` example (#120668)
Bénédikt Tran [Tue, 18 Jun 2024 11:56:58 +0000 (13:56 +0200)] 
gh-120662: Improve `smtplib` example (#120668)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>