]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
112 min agogh-119443: Turn off from __future__ import annotations in REPL (#119493) main
Jelle Zijlstra [Wed, 29 May 2024 00:05:18 +0000 (17:05 -0700)] 
gh-119443: Turn off from __future__ import annotations in REPL (#119493)

3 hours agogh-117398: Convert datetime.IsoCalendarDate To A Heap Type (gh-119637)
Eric Snow [Tue, 28 May 2024 22:42:23 +0000 (18:42 -0400)] 
gh-117398: Convert datetime.IsoCalendarDate To A Heap Type (gh-119637)

This is the only static type in the module that we will not keep static.

5 hours agogh-119538: Add missing expat build dependencies (#119647)
Erlend E. Aasland [Tue, 28 May 2024 20:05:19 +0000 (22:05 +0200)] 
gh-119538: Add missing expat build dependencies (#119647)

xmltok_impl.c and xmltok_ns.c are _included_ in xmltok.c by the C
pre-processor.

6 hours agoGH-119258: Handle STORE_ATTR_WITH_HINT in tier two (GH-119481)
Brandt Bucher [Tue, 28 May 2024 19:47:54 +0000 (12:47 -0700)] 
GH-119258: Handle STORE_ATTR_WITH_HINT in tier two (GH-119481)

6 hours agoGH-119476: Split _CHECK_FUNCTION_VERSION out of _CHECK_FUNCTION_EXACT_ARGS (GH-119510)
Brandt Bucher [Tue, 28 May 2024 19:45:11 +0000 (12:45 -0700)] 
GH-119476: Split _CHECK_FUNCTION_VERSION out of _CHECK_FUNCTION_EXACT_ARGS (GH-119510)

6 hours agogh-119118: Fix performance regression in tokenize module (#119615)
Lysandros Nikolaou [Tue, 28 May 2024 19:17:49 +0000 (21:17 +0200)] 
gh-119118: Fix performance regression in tokenize module (#119615)

* gh-119118: Fix performance regression in tokenize module

- Cache line object to avoid creating a Unicode object
  for all of the tokens in the same line.
- Speed up byte offset to column offset conversion by using the
  smallest buffer possible to measure the difference.

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
6 hours agogh-119676: remove several pseudo instructions which are use only in codegen (#119677)
Irit Katriel [Tue, 28 May 2024 19:05:38 +0000 (20:05 +0100)] 
gh-119676: remove several pseudo instructions which are use only in codegen (#119677)

7 hours agogh-119011: `type.__type_params__` now return an empty tuple (#119296)
Nikita Sobolev [Tue, 28 May 2024 18:12:58 +0000 (21:12 +0300)] 
gh-119011: `type.__type_params__` now return an empty tuple (#119296)

7 hours agogh-117865: Defer import of re in ast (#119546)
Jelle Zijlstra [Tue, 28 May 2024 18:04:08 +0000 (11:04 -0700)] 
gh-117865: Defer import of re in ast (#119546)

This is used only by ast.get_source_segment(), so it seems sensible to avoid importing it.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
8 hours agogh-117398: gh-119655: datetime: Init static state once & don't free it (GH-119662)
Petr Viktorin [Tue, 28 May 2024 17:27:52 +0000 (19:27 +0200)] 
gh-117398: gh-119655: datetime: Init static state once & don't free it (GH-119662)

- While datetime uses global state, only initialize it once.
- While `capi` is static, don't free it (thanks @neonene in https://github.com/python/cpython/pull/119641/files#r1616710048)

8 hours agogh-119581: Add a test of InitVar with name shadowing (#119582)
Steven Troxler [Tue, 28 May 2024 17:18:57 +0000 (10:18 -0700)] 
gh-119581: Add a test of InitVar with name shadowing (#119582)

9 hours agogh-119396: Optimize unicode_repr() (#119617)
Victor Stinner [Tue, 28 May 2024 16:05:20 +0000 (18:05 +0200)] 
gh-119396: Optimize unicode_repr() (#119617)

Use stringlib to specialize unicode_repr() for each string kind
(UCS1, UCS2, UCS4).

Benchmark:

+-------------------------------------+---------+----------------------+
| Benchmark                           | ref     | change2              |
+=====================================+=========+======================+
| repr('abc')                         | 100 ns  | 103 ns: 1.02x slower |
+-------------------------------------+---------+----------------------+
| repr('a' * 100)                     | 369 ns  | 369 ns: 1.00x slower |
+-------------------------------------+---------+----------------------+
| repr(('a' + squote) * 100)          | 1.21 us | 946 ns: 1.27x faster |
+-------------------------------------+---------+----------------------+
| repr(('a' + nl) * 100)              | 1.23 us | 907 ns: 1.36x faster |
+-------------------------------------+---------+----------------------+
| repr(dquote + ('a' + squote) * 100) | 1.08 us | 858 ns: 1.25x faster |
+-------------------------------------+---------+----------------------+
| Geometric mean                      | (ref)   | 1.16x faster         |
+-------------------------------------+---------+----------------------+

10 hours agogh-119659: Move `@no_rerun` to `test.support` (#119660)
Nikita Sobolev [Tue, 28 May 2024 15:50:50 +0000 (18:50 +0300)] 
gh-119659: Move `@no_rerun` to `test.support` (#119660)

12 hours agogh-118824: Remove deprecated `master_open` and `slave_open` from `pty` (#118826)
Nikita Sobolev [Tue, 28 May 2024 13:42:35 +0000 (16:42 +0300)] 
gh-118824: Remove deprecated `master_open` and `slave_open` from `pty` (#118826)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
15 hours ago[doc] Clarify the nature of the root logger in the `logging` documentation (GH-119440)
Justin Kunimune [Tue, 28 May 2024 10:31:20 +0000 (06:31 -0400)] 
[doc] Clarify the nature of the root logger in the `logging` documentation (GH-119440)

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
16 hours agogh-116860: Remove outdated `test_parserhack` from `test_future` (#116861)
Nikita Sobolev [Tue, 28 May 2024 09:16:52 +0000 (12:16 +0300)] 
gh-116860: Remove outdated `test_parserhack` from `test_future` (#116861)

16 hours agogh-117557: Improve error messages when a string, bytes or bytearray of length 1 are...
Serhiy Storchaka [Tue, 28 May 2024 09:01:37 +0000 (12:01 +0300)] 
gh-117557: Improve error messages when a string, bytes or bytearray of length 1 are expected (GH-117631)

18 hours agoFix typos in comments (#119645)
Xie Yanbo [Tue, 28 May 2024 07:53:32 +0000 (15:53 +0800)] 
Fix typos in comments (#119645)

23 hours agogh-119311: Fix name mangling with PEP 695 generic classes (#119464)
Jelle Zijlstra [Tue, 28 May 2024 02:50:38 +0000 (19:50 -0700)] 
gh-119311: Fix name mangling with PEP 695 generic classes (#119464)

Fixes #119311. Fixes #119395.

27 hours agogh-117398: Add multiphase support to _datetime (gh-119373)
Erlend E. Aasland [Mon, 27 May 2024 22:02:46 +0000 (00:02 +0200)] 
gh-117398: Add multiphase support to _datetime (gh-119373)

This is minimal support.  Subinterpreters are not supported yet.  That will be addressed in a later change.

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
30 hours agogh-119584: Fix test_import Failed Assertion (gh-119623)
Eric Snow [Mon, 27 May 2024 19:35:30 +0000 (15:35 -0400)] 
gh-119584: Fix test_import Failed Assertion (gh-119623)

The fix in gh-119561 introduced an assertion that doesn't hold true if any of the three new test extension modules are loaded more than once.  This is fine normally but breaks if the new test_check_state_first() is run more than once, which happens for refleak checking and with the regrtest --forever flag.  We fix that here by clearing each of the three modules after loading them.  We also tweak a check in _modules_by_index_check().

31 hours agoMisc cleanups and wording improvements for the itertools docs (gh-119626)
Raymond Hettinger [Mon, 27 May 2024 18:22:57 +0000 (13:22 -0500)] 
Misc cleanups and wording improvements for the itertools docs (gh-119626)

31 hours agoWithdraw most of my ownership in favor of Mark (#119611)
Guido van Rossum [Mon, 27 May 2024 18:07:16 +0000 (11:07 -0700)] 
Withdraw most of my ownership in favor of Mark (#119611)

31 hours agoDocs: Move inline JavaScript to own file to reduce duplication (#119541)
Hugo van Kemenade [Mon, 27 May 2024 18:04:34 +0000 (21:04 +0300)] 
Docs: Move inline JavaScript to own file to reduce duplication (#119541)

32 hours agogh-119580: Improve version added section for convenience variable (#119583)
Tian Gao [Mon, 27 May 2024 17:54:23 +0000 (10:54 -0700)] 
gh-119580: Improve version added section for convenience variable (#119583)

32 hours agoDocs: Only install sphinx-autobuild for `make htmllive` (#119607)
Hugo van Kemenade [Mon, 27 May 2024 17:29:27 +0000 (20:29 +0300)] 
Docs: Only install sphinx-autobuild for `make htmllive` (#119607)

37 hours agoDocs: Add class role for IPV{4,6}Address and fix a typo (#118059)
Rafael Fontenelle [Mon, 27 May 2024 12:39:59 +0000 (09:39 -0300)] 
Docs: Add class role for IPV{4,6}Address and fix a typo (#118059)

Add class role for IPV{4,6}Address and fix a typo

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
37 hours agoGH-117283: Add doc warning for `PyTuple_SetItem` refcount > 1 (#117916)
Savannah Ostrowski [Mon, 27 May 2024 12:20:28 +0000 (05:20 -0700)] 
GH-117283: Add doc warning for `PyTuple_SetItem` refcount > 1 (#117916)

37 hours agogh-119467: Fix Py_buffer.format type and correct documentation typo (#119475)
Aditya Borikar [Mon, 27 May 2024 12:16:13 +0000 (06:16 -0600)] 
gh-119467: Fix Py_buffer.format type and correct documentation typo (#119475)

38 hours ago``Include/internal/pycore_import.h``: Fix typo (#119586)
Kirill Podoprigora [Mon, 27 May 2024 11:35:36 +0000 (14:35 +0300)] 
``Include/internal/pycore_import.h``: Fix typo (#119586)

Fix typo

42 hours agoFix typos in HISTORY documentation (#119453)
Xie Yanbo [Mon, 27 May 2024 07:57:23 +0000 (15:57 +0800)] 
Fix typos in HISTORY documentation (#119453)

2 days agoRe-order imports to align with zipp 3.18.2 (#119587)
Jason R. Coombs [Mon, 27 May 2024 01:33:16 +0000 (21:33 -0400)] 
Re-order imports to align with zipp 3.18.2 (#119587)

2 days agogh-102864: Add switching frame test for pdb (#119564)
Tian Gao [Sun, 26 May 2024 17:05:23 +0000 (10:05 -0700)] 
gh-102864: Add switching frame test for pdb (#119564)

2 days agogh-119562: Remove unused private string constants from `ast.py` (#119576)
Alex Waygood [Sun, 26 May 2024 13:31:02 +0000 (14:31 +0100)] 
gh-119562: Remove unused private string constants from `ast.py` (#119576)

2 days agogh-111997: Fix argument count for LINE event and clarify type of argument counts...
scoder [Sun, 26 May 2024 12:37:33 +0000 (14:37 +0200)] 
gh-111997: Fix argument count for LINE event and clarify type of argument counts. (#119179)

2 days agogh-119562: Remove AST nodes deprecated since Python 3.8 (#119563)
Alex Waygood [Sun, 26 May 2024 12:34:48 +0000 (13:34 +0100)] 
gh-119562: Remove AST nodes deprecated since Python 3.8 (#119563)

2 days agoUpdate README and layout.html from 3.13 to 3.14 (#119539)
Wulian233 [Sun, 26 May 2024 11:26:59 +0000 (19:26 +0800)] 
Update README and layout.html from 3.13 to 3.14 (#119539)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
3 days agodocs: fix a few typos identified by codespell (#119516)
Ned Batchelder [Sun, 26 May 2024 01:13:31 +0000 (21:13 -0400)] 
docs: fix a few typos identified by codespell (#119516)

3 days agoGH-82805: Fix handling of single-dot file extensions in pathlib (#118952)
Barney Gale [Sat, 25 May 2024 20:01:36 +0000 (21:01 +0100)] 
GH-82805: Fix handling of single-dot file extensions in pathlib (#118952)

pathlib now treats "`.`" as a valid file extension (suffix). This brings
it in line with `os.path.splitext()`.

In the (private) pathlib ABCs, we add a new `ParserBase.splitext()` method
that splits a path into a `(root, ext)` pair, like `os.path.splitext()`.
This method is called by `PurePathBase.stem`, `suffix`, etc. In a future
version of pathlib, we might make these base classes public, and so users
will be able to define their own `splitext()` method to control file
extension splitting.

In `pathlib.PurePath` we add optimised `stem`, `suffix` and `suffixes`
properties that don't use `splitext()`, which avoids computing the path
base name twice.

3 days agogh-119560: Drop an Invalid Assert in PyState_FindModule() (gh-119561)
Eric Snow [Sat, 25 May 2024 19:30:48 +0000 (15:30 -0400)] 
gh-119560: Drop an Invalid Assert in PyState_FindModule() (gh-119561)

The assertion was added in gh-118532 but was based on the invalid assumption that PyState_FindModule() would only be called with an already-initialized module def.  I've added a test to make sure we don't make that assumption again.

3 days agogh-99180: Make `StackSummary.should_show_carets` private (#119554)
Alex Waygood [Sat, 25 May 2024 17:08:32 +0000 (18:08 +0100)] 
gh-99180: Make `StackSummary.should_show_carets` private (#119554)

3 days agoAdd codeowners for PYREPL (#119550)
Pablo Galindo Salgado [Sat, 25 May 2024 16:21:07 +0000 (17:21 +0100)] 
Add codeowners for PYREPL (#119550)

3 days agogh-119548: Add a 'clear' command to the REPL (#119549)
Pablo Galindo Salgado [Sat, 25 May 2024 16:15:54 +0000 (17:15 +0100)] 
gh-119548: Add a 'clear' command to the REPL (#119549)

3 days agoFAQ: Add reference to Python version numbering scheme (#119225)
Hugo van Kemenade [Sat, 25 May 2024 14:13:17 +0000 (17:13 +0300)] 
FAQ: Add reference to Python version numbering scheme (#119225)

3 days agogh-111999: Fix the signature of str.format_map() (#119540)
Serhiy Storchaka [Sat, 25 May 2024 13:21:11 +0000 (16:21 +0300)] 
gh-111999: Fix the signature of str.format_map() (#119540)

3 days agogh-119105: Differ.compare is too slow [for degenerate cases] (#119492)
Tim Peters [Sat, 25 May 2024 03:08:21 +0000 (22:08 -0500)] 
gh-119105: Differ.compare is too slow [for degenerate cases] (#119492)

``_fancy_replace()`` is no longer recursive. and a single call does a worst-case linear number of ratio() computations instead of quadratic. This renders toothless a universe of pathological cases. Some inputs may produce different output, but that's rare, and I didn't find a case where the final diff appeared to be of materially worse quality. To the contrary, by refusing to even consider synching on lines "far apart", there was more easy-to-digest locality in the output.

4 days agogh-119180: Update the magic number (#119397)
Jelle Zijlstra [Sat, 25 May 2024 00:32:17 +0000 (17:32 -0700)] 
gh-119180: Update the magic number (#119397)

PR #119321 added a comment about the magic number bump
but did not actually apply the new magic number.

4 days agoMisc improvement to the docs for itertools (gh-119529)
Raymond Hettinger [Fri, 24 May 2024 21:58:24 +0000 (16:58 -0500)] 
Misc improvement to the docs for itertools (gh-119529)

4 days agoGH-119054: Add "Querying file type and status" section to pathlib docs (#119055)
Barney Gale [Fri, 24 May 2024 19:35:13 +0000 (20:35 +0100)] 
GH-119054: Add "Querying file type and status" section to pathlib docs (#119055)

Add a dedicated subsection for `Path.stat()`-related methods, specifically
`stat()`, `lstat()`, `exists()`, `is_*()`, and `samefile()`.

4 days agoRegen ``Doc/requirements-oldest-sphinx.txt`` (#119520)
Kirill Podoprigora [Fri, 24 May 2024 19:30:32 +0000 (22:30 +0300)] 
Regen ``Doc/requirements-oldest-sphinx.txt`` (#119520)

4 days agogh-118263: Add additional arguments to path_t (Argument Clinic type) in posixmodule...
Nice Zombies [Fri, 24 May 2024 18:04:17 +0000 (20:04 +0200)] 
gh-118263: Add additional arguments to path_t (Argument Clinic type) in posixmodule (GH-118355)

4 days agogh-112075: Fix dict thread safety issues (#119288)
Germán Méndez Bravo [Fri, 24 May 2024 17:39:06 +0000 (10:39 -0700)] 
gh-112075: Fix dict thread safety issues (#119288)

Fix dict thread safety issues

4 days agoGH-119496: accept UTF-8 BOM in .pth files (GH-119503)
Alyssa Coghlan [Fri, 24 May 2024 14:29:19 +0000 (00:29 +1000)] 
GH-119496: accept UTF-8 BOM in .pth files (GH-119503)

`Out-File -Encoding utf8` and similar commands in Windows Powershell 5.1 emit
UTF-8 with a BOM marker, which the regular `utf-8` codec decodes incorrectly.

`utf-8-sig` accepts a BOM, but also works correctly without one.

This change also makes .pth files match the way Python source files are handled.

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
4 days agogh-69214: Fix fcntl.ioctl() request type (#119498)
Victor Stinner [Fri, 24 May 2024 12:31:40 +0000 (14:31 +0200)] 
gh-69214: Fix fcntl.ioctl() request type (#119498)

Use an 'unsigned long' instead of an 'unsigned int' for the request
parameter of fcntl.ioctl() to support requests larger than UINT_MAX.

4 days agoGH-113464: Run the JIT interpreter before any other JIT CI (GH-119466)
Brandt Bucher [Fri, 24 May 2024 03:13:41 +0000 (23:13 -0400)] 
GH-113464: Run the JIT interpreter before any other JIT CI (GH-119466)

4 days agogh-119317: findall instead of traverse for docutils nodes (#119319)
Carlos Meza [Fri, 24 May 2024 02:04:12 +0000 (19:04 -0700)] 
gh-119317: findall instead of traverse for docutils nodes (#119319)

5 days agoClarify base64.a85encode docs: *wrapcols* doesn't count the newline (GH-119409)
Petr Viktorin [Thu, 23 May 2024 22:11:45 +0000 (00:11 +0200)] 
Clarify base64.a85encode docs: *wrapcols* doesn't count the newline (GH-119409)

5 days agogh-119461: Fix ThreadedVSOCKSocketStreamTest (#119465)
Victor Stinner [Thu, 23 May 2024 21:26:09 +0000 (23:26 +0200)] 
gh-119461: Fix ThreadedVSOCKSocketStreamTest (#119465)

Add socket.VMADDR_CID_LOCAL constant.

Fix ThreadedVSOCKSocketStreamTest: if get_cid() returns the host
address or the "any" address, use the local communication address
(loopback): VMADDR_CID_LOCAL.

On Linux 6.9, apparently, the /dev/vsock device is now available but
get_cid() returns VMADDR_CID_ANY (-1).

5 days agogh-118727: Don't drop the GIL in `drop_gil()` unless the current thread holds it...
Brett Simmers [Thu, 23 May 2024 20:59:35 +0000 (16:59 -0400)] 
gh-118727: Don't drop the GIL in `drop_gil()` unless the current thread holds it (#118745)

`drop_gil()` assumes that its caller is attached, which means that the current
thread holds the GIL if and only if the GIL is enabled, and the enabled-state
of the GIL won't change. This isn't true, though, because `detach_thread()`
calls `_PyEval_ReleaseLock()` after detaching and
`_PyThreadState_DeleteCurrent()` calls it after removing the current thread
from consideration for stop-the-world requests (effectively detaching it).

Fix this by remembering whether or not a thread acquired the GIL when it last
attached, in `PyThreadState._status.holds_gil`, and check this in `drop_gil()`
instead of `gil->enabled`.

This fixes a crash in `test_multiprocessing_pool_circular_import()`, so I've
reenabled it.

5 days agogh-117398: Statically Allocate the Datetime C-API (GH-119472)
Eric Snow [Thu, 23 May 2024 19:15:52 +0000 (15:15 -0400)] 
gh-117398: Statically Allocate the Datetime C-API (GH-119472)

5 days agogh-119469: Fix _pyrepl reference leaks (#119470)
Łukasz Langa [Thu, 23 May 2024 17:28:31 +0000 (13:28 -0400)] 
gh-119469: Fix _pyrepl reference leaks (#119470)

5 days agogh-117142: Slightly hacky fix for memory leak of StgInfo (GH-119424)
Petr Viktorin [Thu, 23 May 2024 16:01:37 +0000 (18:01 +0200)] 
gh-117142: Slightly hacky fix for memory leak of StgInfo (GH-119424)

Add a funciton that inlines PyObject_GetTypeData and skips
type-checking, so it doesn't need access to the CType_Type object.
This will break if the memory layout changes, but should
be an acceptable solution to enable ctypes in subinterpreters in
Python 3.13.

Mark _ctypes as safe for multiple interpreters

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
5 days agoGH-117195: Avoid assertion error in `object.__sizeof__` (GH-117220)
Mark Shannon [Thu, 23 May 2024 10:06:10 +0000 (11:06 +0100)] 
GH-117195: Avoid assertion error in `object.__sizeof__` (GH-117220)

5 days agogh-119431: fix refleak in test_monitoring (#119444)
Irit Katriel [Thu, 23 May 2024 09:21:53 +0000 (05:21 -0400)] 
gh-119431: fix refleak in test_monitoring (#119444)

5 days agoFix typos in what's new documentation (#119448)
Xie Yanbo [Thu, 23 May 2024 06:41:33 +0000 (14:41 +0800)] 
Fix typos in what's new documentation (#119448)

5 days agoTiny fix: Update link for HAC algorithm (gh-118546)
Ayato Hayashi [Thu, 23 May 2024 02:11:11 +0000 (11:11 +0900)] 
Tiny fix: Update link for HAC algorithm (gh-118546)

6 days agogh-119105: difflib.py Differ.compare is too slow [for degenerate cases] (#119376)
Tim Peters [Wed, 22 May 2024 23:25:08 +0000 (18:25 -0500)] 
gh-119105: difflib.py Differ.compare is too slow [for degenerate cases] (#119376)

Track all pairs achieving the best ratio in Differ(). This repairs the "very deep recursion and cubic time" bad cases in a way that preserves previous output.

6 days agogh-119434: Fix culmitive errors in wrapping as lines proceed (#119435)
Dino Viehland [Wed, 22 May 2024 22:03:32 +0000 (15:03 -0700)] 
gh-119434: Fix culmitive errors in wrapping as lines proceed (#119435)

Fix culmitive errors in wrapping as lines proceed

6 days agogh-119396: Optimize PyUnicode_FromFormat() UTF-8 decoder (#119398)
Victor Stinner [Wed, 22 May 2024 21:05:26 +0000 (23:05 +0200)] 
gh-119396: Optimize PyUnicode_FromFormat() UTF-8 decoder (#119398)

Add unicode_decode_utf8_writer() to write directly characters into a
_PyUnicodeWriter writer: avoid the creation of a temporary string.
Optimize PyUnicode_FromFormat() by using the new
unicode_decode_utf8_writer().

Rename unicode_fromformat_write_cstr() to
unicode_fromformat_write_utf8().

Microbenchmark on the code:

    return PyUnicode_FromFormat(
        "%s %s %s %s %s.",
        "format", "multiple", "utf8", "short", "strings");

Result: 620 ns +- 8 ns -> 382 ns +- 2 ns: 1.62x faster.

6 days agogh-111201: Use calc_complete_screen after bracketed paste in PyREPL (#119432)
Lysandros Nikolaou [Wed, 22 May 2024 21:02:33 +0000 (17:02 -0400)] 
gh-111201: Use calc_complete_screen after bracketed paste in PyREPL (#119432)

6 days agogh-117142: ctypes: Clean up c-analyzer .tsv files (GH-117544)
neonene [Wed, 22 May 2024 20:30:41 +0000 (05:30 +0900)] 
gh-117142: ctypes: Clean up c-analyzer .tsv files (GH-117544)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
6 days agogh-70795: Rework RLock documentation (#103853)
uıɐɾ ʞ ʇɐɯɐs [Wed, 22 May 2024 20:15:11 +0000 (13:15 -0700)] 
gh-70795: Rework RLock documentation (#103853)

Attempted to simultaneously reduce verbosity, while more descriptively
describing behavior.

Fix links (RLock acquire/release previously linking to Lock
acquire/release, seems like bad copy pasta).

Add a seealso for with-locks.

Switch section to use bullet points.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
6 days agogh-117505: Run ensurepip in isolated env in Windows installer (GH-118257)
Michael Vincent [Wed, 22 May 2024 17:59:47 +0000 (12:59 -0500)] 
gh-117505: Run ensurepip in isolated env in Windows installer (GH-118257)

ensurepip forks a subprocess to run pip itself, but that subprocess only inherits a -I isolated mode flag (see _run_pip() in Lib/ensurepip/__init__.py), not the "-E -s" flags that the installer has been using. This means that parts of ensurepip don't actually run in an isolated environment and can make incorrect decisions based on packages installed in the user site-packages.

6 days agogh-119247: Add macros to use PySequence_Fast safely in free-threaded build (#119315)
Josh {*()} Rosenberg [Wed, 22 May 2024 17:45:34 +0000 (17:45 +0000)] 
gh-119247: Add macros to use PySequence_Fast safely in free-threaded build (#119315)

Add `Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST` and
`Py_END_CRITICAL_SECTION_SEQUENCE_FAST` macros and update `str.join` to use
them. Also add a regression test that would crash reliably without this
patch.

6 days agogh-117657: Fix missing atomic in dict_resize (#119312)
Dino Viehland [Wed, 22 May 2024 17:38:56 +0000 (13:38 -0400)] 
gh-117657: Fix missing atomic in dict_resize (#119312)

Fix missing atomic in dict_resize

6 days agoRemove almost all unpaired backticks in docstrings (#119231)
Geoffrey Thomas [Wed, 22 May 2024 16:35:18 +0000 (12:35 -0400)] 
Remove almost all unpaired backticks in docstrings (#119231)

As reported in #117847 and #115366, an unpaired backtick in a docstring
tends to confuse e.g. Sphinx running on subclasses of standard library
objects, and the typographic style of using a backtick as an opening
quote is no longer in favor. Convert almost all uses of the form

    The variable `foo' should do xyz

to

    The variable 'foo' should do xyz

and also fix up miscellaneous other unpaired backticks (extraneous /
missing characters).

No functional change is intended here other than in human-readable
docstrings.

6 days agogh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331)
Eric Snow [Wed, 22 May 2024 15:57:52 +0000 (11:57 -0400)] 
gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331)

_PyArg_Parser holds static global data generated for modules by Argument Clinic.  The _PyArg_Parser.kwtuple field is a tuple object, even though it's stored within a static global.  In some cases the tuple is statically allocated and thus it's okay that it gets shared by multiple interpreters.  However, in other cases the tuple is set lazily, allocated from the heap using the active interprepreter at the point the tuple is needed.

This is a problem once that interpreter is destroyed since _PyArg_Parser.kwtuple becomes at dangling pointer, leading to crashes.  It isn't a problem if the tuple is allocated under the main interpreter, since its lifetime is bound to the lifetime of the runtime.  The solution here is to temporarily switch to the main interpreter.  The alternative would be to always statically allocate the tuple.

This change also fixes a bug where only the most recent parser was added to the global linked list.

6 days agogh-119391: Amend comment description of PyMapping_Items, PyMapping_Values and PyMappi...
Pieter Eendebak [Wed, 22 May 2024 12:52:36 +0000 (14:52 +0200)] 
gh-119391: Amend comment description of PyMapping_Items, PyMapping_Values and PyMapping_Keys (#119392)

The behaviour was changed in 0ccc0f6c7.

6 days agogh-118643: Fix AttributeError in the email module (GH-119099)
Serhiy Storchaka [Wed, 22 May 2024 10:17:46 +0000 (13:17 +0300)] 
gh-118643: Fix AttributeError in the email module (GH-119099)

Fix regression introduced in gh-100884: AttributeError when re-fold a long
address list.

Also fix more cases of incorrect encoding of the address separator in the
address list missed in gh-100884.

6 days agoFix version number in use_load_tests deprecation reference (GH-119151)
Jacob Walls [Wed, 22 May 2024 09:43:56 +0000 (05:43 -0400)] 
Fix version number in use_load_tests deprecation reference (GH-119151)

Deprecation took place in d78742a260ba09e53c844de7b1fd11a11c674945 (3.5)

6 days agoFix typos in NEWS entries for 3.13 (GH-119374)
Xie Yanbo [Wed, 22 May 2024 09:31:37 +0000 (17:31 +0800)] 
Fix typos in NEWS entries for 3.13 (GH-119374)

6 days agoClarify that dklen is expected in bytes for the hashlib functions (GH-106624)
Mathijs Mortimer [Wed, 22 May 2024 08:51:25 +0000 (10:51 +0200)] 
Clarify that dklen is expected in bytes for the hashlib functions (GH-106624)

6 days agoDOCS: fix error in exec namespace note (gh-119378)
Alyssa Coghlan [Wed, 22 May 2024 06:38:06 +0000 (16:38 +1000)] 
DOCS: fix error in exec namespace note (gh-119378)

When updating the new exec note added in gh-119235 as part of the
PEP 667 general docs PR, I suggested a workaround that isn't valid.

The first half of the note is still reasonable, so just omit the invalid text.

6 days agogh-118911: Trailing whitespace in a block shouldn't prevent the user from terminating...
Aya Elsayed [Wed, 22 May 2024 05:56:35 +0000 (06:56 +0100)] 
gh-118911: Trailing whitespace in a block shouldn't prevent the user from terminating the code block (#119355)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
6 days agogh-111201: Speed up paste mode in the REPL (#119341)
Pablo Galindo Salgado [Wed, 22 May 2024 05:28:32 +0000 (01:28 -0400)] 
gh-111201: Speed up paste mode in the REPL (#119341)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
6 days agogh-111201: auto-indentation in _pyrepl (#119348)
Arnon Yaari [Wed, 22 May 2024 04:21:14 +0000 (00:21 -0400)] 
gh-111201: auto-indentation in _pyrepl (#119348)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
6 days agogh-119180: PEP 649: Add __annotate__ attributes (#119209)
Jelle Zijlstra [Wed, 22 May 2024 02:38:12 +0000 (22:38 -0400)] 
gh-119180: PEP 649: Add __annotate__ attributes (#119209)

6 days agogh-119357: Increase test coverage for keymap in _pyrepl (#119358)
Eugene Triguba [Wed, 22 May 2024 02:36:01 +0000 (22:36 -0400)] 
gh-119357: Increase test coverage for keymap in _pyrepl (#119358)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
6 days agogh-111201: Add append to screen method to avoid recalculation (#119274)
Lysandros Nikolaou [Wed, 22 May 2024 02:35:44 +0000 (22:35 -0400)] 
gh-111201: Add append to screen method to avoid recalculation (#119274)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
7 days agogh-60191: Implement ast.compare (#19211)
Batuhan Taskaya [Wed, 22 May 2024 01:39:26 +0000 (04:39 +0300)] 
gh-60191: Implement ast.compare (#19211)

* bpo-15987: Implement ast.compare

Add a compare() function that compares two ASTs for structural equality. There are two set of attributes on AST node objects, fields and attributes. The fields are always compared, since they represent the actual structure of the code. The attributes can be optionally be included in the comparison. Attributes capture things like line numbers of column offsets, so comparing them involves test whether the layout of the program text is the same. Since whitespace seems inessential for comparing ASTs, the default is to compare fields but not attributes.

ASTs are just Python objects that can be modified in arbitrary ways. The API for ASTs is under-specified in the presence of user modifications to objects. The comparison respects modifications to fields and attributes, and to _fields and _attributes attributes. A user could create obviously malformed objects, and the code will probably fail with an AttributeError when that happens. (For example, adding "spam" to _fields but not adding a "spam" attribute to the object.)

Co-authored-by: Jeremy Hylton <jeremy@alum.mit.edu>
7 days agogh-110383: Align dict.get(), .fromkeys(), and .setdefault() docs with docstrings...
Landon Wood [Wed, 22 May 2024 01:15:40 +0000 (21:15 -0400)] 
gh-110383: Align dict.get(), .fromkeys(), and .setdefault() docs with docstrings (#119330)

7 days agogh-119180: Add LOAD_COMMON_CONSTANT opcode (#119321)
Jelle Zijlstra [Wed, 22 May 2024 00:46:39 +0000 (20:46 -0400)] 
gh-119180: Add LOAD_COMMON_CONSTANT opcode (#119321)

The PEP 649 implementation will require a way to load NotImplementedError
from the bytecode. @markshannon suggested implementing this by converting
LOAD_ASSERTION_ERROR into a more general mechanism for loading constants.

This PR adds this new opcode. I will work on the rest of the implementation
of the PEP separately.

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
7 days agogh-119205: Fix autocompletion bug in new repl (#119229)
Koudai Aono [Tue, 21 May 2024 23:22:21 +0000 (19:22 -0400)] 
gh-119205: Fix autocompletion bug in new repl (#119229)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
7 days agogh-118893: Evaluate all statements in the new REPL separately (#119318)
Pablo Galindo Salgado [Tue, 21 May 2024 23:16:56 +0000 (19:16 -0400)] 
gh-118893: Evaluate all statements in the new REPL separately (#119318)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
7 days agoDocs: Add central references to free-threading-related options (#119017)
Brett Simmers [Tue, 21 May 2024 21:49:23 +0000 (17:49 -0400)] 
Docs: Add central references to free-threading-related options (#119017)

7 days agogh-118692: Avoid creating unnecessary StopIteration instances for monitoring (#119216)
Irit Katriel [Tue, 21 May 2024 20:42:51 +0000 (16:42 -0400)] 
gh-118692: Avoid creating unnecessary StopIteration instances for monitoring (#119216)

7 days agogh-118507 : Refactor `nt._path_is*` to improve applicability for other cases (GH...
Nice Zombies [Tue, 21 May 2024 20:36:36 +0000 (22:36 +0200)] 
gh-118507 : Refactor `nt._path_is*` to improve applicability for other cases (GH-118755)

7 days agogh-119102: Fix REPL for dumb terminal (#119332)
Victor Stinner [Tue, 21 May 2024 20:33:52 +0000 (22:33 +0200)] 
gh-119102: Fix REPL for dumb terminal (#119332)

The site module gets the __main__ module to get _pyrepl.__main__.

7 days agogh-111201: Remove readline dependency from the PyREPL (#119262)
Lysandros Nikolaou [Tue, 21 May 2024 20:30:45 +0000 (16:30 -0400)] 
gh-111201: Remove readline dependency from the PyREPL (#119262)

7 days agogh-90562: Mention slots pitfall in dataclass docs (#107391)
Josh Cannon [Tue, 21 May 2024 19:37:32 +0000 (14:37 -0500)] 
gh-90562: Mention slots pitfall in dataclass docs (#107391)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>