Commit Graph

52991 Commits

Author SHA1 Message Date
Miss Islington (bot) 96c524cef6
[3.13] gh-121842: Improve coverage of `PyBytes_FromStringAndSize` (GH-121843) (#121893)
gh-121842: Improve coverage of `PyBytes_FromStringAndSize` (GH-121843)
(cherry picked from commit f6c7d8d79c)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-07-17 07:24:44 +00:00
Miss Islington (bot) 6613029084
[3.13] gh-121860: Fix crash when materializing managed dict (GH-121866) (#121867)
The object's inline values may be marked invalid if the materialized
dict was already initialized and then deleted.
(cherry picked from commit 162b41f577)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-16 19:26:01 +00:00
Pablo Galindo Salgado d24ec8a47c
[3.13] gh-121130: Fix f-string format specifiers with debug expressions (GH-121150) (#121868)
(cherry picked from commit c46d64e0ef)
2024-07-16 19:25:04 +00:00
Miss Islington (bot) 7c9861f9d9
[3.13] gh-121160: Add some tests for readline.set_history_length (GH-121326) (GH-121856)
(cherry picked from commit 263c7e611b)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-07-16 17:15:51 +02:00
Miss Islington (bot) e45c61f736
[3.13] gh-120317: Lock around global state in the tokenize module (GH-120318) (#121841)
(cherry picked from commit 8549559f38)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2024-07-16 10:03:47 +00:00
Miss Islington (bot) d02adecb42
[3.13] gh-119189: Fix the power operator for Fraction (GH-119242) (GH-119836)
When using the ** operator or pow() with Fraction as the base
and an exponent that is not rational, a float, or a complex, the
fraction is no longer converted to a float.
(cherry picked from commit b9965ef282)

Co-authored-by: Joshua Herman <30265+zitterbewegung@users.noreply.github.com>
2024-07-16 10:44:23 +03:00
Miss Islington (bot) 4a62fdf35d
[3.13] gh-121295: Fix blocked console after interrupting a long paste (GH-121815) (GH-121826)
(cherry picked from commit 498a94c198)

Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
2024-07-16 08:29:04 +02:00
Miss Islington (bot) 73f77e642a
[3.13] gh-121610: pyrepl - handle extending blocks when multi-statement blocks are pasted (GH-121757) (GH-121825)
console.compile with the "single" param throws an exception when
there are multiple statements, never allowing to adding newlines
to a pasted code block (gh-121610)

This adds a few extra checks to allow extending when in an indented
block, and tests for a few examples.

(cherry picked from commit 7d111dac16)

Co-authored-by: saucoide <32314353+saucoide@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-16 08:28:41 +02:00
Miss Islington (bot) 0201b98d4c
[3.13] gh-121605: Fix test hang when pyrepl is not available (GH-121820) (GH-121823)
The fallback repl does not support "exit" without parentheses, so the
test would hang until the timeout expired.
(cherry picked from commit 4134261ab8)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-16 01:15:18 +02:00
Miss Islington (bot) 5b718e7fc7
[3.13] gh-121790: Fix interactive console initialization (GH-121793) (GH-121822)
(cherry picked from commit e5c7216f37)

Co-authored-by: Milan Oberkirch <milan.oberkirch@geops.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-16 00:49:41 +02:00
Miss Islington (bot) 6396c77571
[3.13] gh-117657: Skip tests that fork with threads under TSan (GH-121599) (#121819)
This avoids messages like:

  ThreadSanitizer: starting new threads after multi-threaded fork is not
  supported. Dying (set die_after_fork=0 to override)
(cherry picked from commit 82a4dac9f6)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-15 21:10:37 +00:00
Miss Islington (bot) b506de4eb5
[3.13] gh-121245: Refactor site.register_readline() (GH-121659) (GH-121816)
(cherry picked from commit 05d413764c)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-15 22:49:18 +02:00
Miss Islington (bot) 2ee2bfe617
[3.13] gh-121359: make clean environment (no PYTHON* vars) for test_pyrepl.TestMain (GH-121672) (GH-121810)
(cherry picked from commit fd085a411e)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-15 22:32:28 +02:00
Miss Islington (bot) 835f4add60
[3.13] gh-76785: Expand How Interpreter Channels Handle Interpreter Finalization (gh-121811)
See 6b98b274b6 for an explanation of the problem and solution.  Here I've applied the solution to channels.

(cherry picked from commit 8b209fd4f8, AKA gh-121805)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-15 20:15:47 +00:00
Kirill Podoprigora c4daec4319
[3.13] gh-121657: Display correct error message for yield from outsid… (GH-121768)
(cherry picked from commit 178e44de8f)

Co-authored-by: Gregor <36135323+gege-hoho@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-15 21:25:54 +02:00
Miss Islington (bot) f19ccfdae0
[3.13] gh-76785: Expand How Interpreter Queues Handle Interpreter Finalization (gh-121807)
Any cross-interpreter mechanism for passing objects between interpreters must be very careful to respect isolation, even when the object is effectively immutable (e.g. int, str).  Here this especially relates to when an interpreter sends one of its objects, and then is destroyed while the inter-interpreter machinery (e.g. queue) still holds a reference to the object.

When I added interpreters.Queue, I dealt with that case (using an atexit hook) by silently removing all items from the queue that were added by the finalizing interpreter.

Later, while working on concurrent.futures.InterpreterPoolExecutor (gh-116430), I noticed it was somewhat surprising when items were silently removed from the queue when the originating interpreter was destroyed.  (See my comment on that PR.)
 It took me a little while to realize what was going on.  I expect that users, which much less context than I have, would experience the same pain.

My approach, here, to improving the situation is to give users three options:

1. return a singleton (interpreters.queues.UNBOUND) from Queue.get() in place of each removed item
2. raise an exception (interpreters.queues.ItemInterpreterDestroyed) from Queue.get() in place of each removed item
3. existing behavior: silently remove each item (i.e. Queue.get() skips each one)

The default will now be (1), but users can still explicitly opt in any of them, including to the silent removal behavior.

The behavior for each item may be set with the corresponding Queue.put() call. and a queue-wide default may be set when the queue is created.  (This is the same as I did for "synconly".)

(cherry picked from commit 6b98b274b6, AKA gh-116431)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-15 19:13:51 +00:00
Miss Islington (bot) 308857b82a
[3.13] gh-121746: Bind Alt+Enter to "accept" in the REPL (GH-121754) (GH-121803)
(cherry picked from commit 6522f0e438)

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2024-07-15 20:14:50 +02:00
Miss Islington (bot) 55ff124b9c
[3.13] gh-57141: Make shallow argument to filecmp.dircmp keyword-only (GH-121767) (#121777)
It is our general practice to make new optional parameters keyword-only,
even if the existing parameters are all positional-or-keyword. Passing
this parameter as positional would look confusing and could be error-prone
if additional parameters are added in the future.
(cherry picked from commit 50eec501fe)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-07-14 23:17:26 +00:00
Miss Islington (bot) dfedbdba40
[3.13] gh-120012: clarify the behaviour of `multiprocessing.Queue.empty` on closed queues. (GH-120102) (#120469)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-07-14 04:24:58 -06:00
Miss Islington (bot) e28f863bd5
[3.13] gh-121609: Fix pasting of characters containing unicode character joiner (GH-121667) (#121733)
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
2024-07-14 03:02:46 -06:00
Miss Islington (bot) e8594aadd5
[3.13] gh-121708: Improve test coverage for `unittest.util` (GH-121713) (GH-121738)
(cherry picked from commit 901ea411bf)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2024-07-14 08:32:41 +00:00
Miss Islington (bot) f0c29a2d9f
[3.13] gh-121711: Set `-m asyncio` return_code to 1 for ENOTTY (GH-121714) (GH-121718)
Set return_code to 1 for ENOTTY
(cherry picked from commit a183474293)

Co-authored-by: Milan Oberkirch <milan.oberkirch@geops.com>
2024-07-13 18:24:52 +02:00
Miss Islington (bot) 14c5bffcc5
[3.13] gh-121605: Increase timeout in test_pyrepl.run_repl (GH-121606) (#121702)
We also need to close the `slave_fd` earlier so that reading from
`master_fd` won't block forever when the subprocess finishes.
(cherry picked from commit abc3aeebdb)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-13 12:07:12 -04:00
Miss Islington (bot) 62572f10aa
[3.13] gh-121497: Make Pyrepl respect correctly the history with input hook set (GH-121498) (#121703)
gh-121497: Make Pyrepl respect correctly the history with input hook set (GH-121498)
(cherry picked from commit 4e36dd7d87)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-07-13 14:28:49 +00:00
Miss Islington (bot) de51ee0c23
[3.13] gh-121499: Fix multi-line history rendering in the REPL (GH-121531) (#121679)
gh-121499: Fix multi-line history rendering in the REPL (GH-121531)
(cherry picked from commit 4b9e10d0ea)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-07-13 15:56:56 +02:00
Miss Islington (bot) 5e8bb98419
[3.13] gh-121671: Increase test coverage of `ast.get_docstring` (GH-121674) (GH-121691)
(cherry picked from commit 0a26aa5007)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2024-07-13 13:30:40 +00:00
Ken Jin cd74ed0a71
[3.13] gh-120198: Stop the world when setting __class__ on free-threaded build (#121591)
(cherry-picked from commit 3bfc9c8)
2024-07-12 19:35:53 +08:00
Miss Islington (bot) 35f7155bc3
[3.13] gh-121103: Put free-threaded libraries in `lib/python3.14t` (GH-121293) (#121631)
On POSIX systems, excluding macOS framework installs, the lib directory
for the free-threaded build now includes a "t" suffix to avoid conflicts
with a co-located default build installation.
(cherry picked from commit e8c91d90ba)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-11 21:00:28 +00:00
Miss Islington (bot) c6dbfbbe3c
[3.13] gh-117482: Fix Builtin Types Slot Wrappers (gh-121630)
When builtin static types are initialized for a subinterpreter, various "tp" slots have already been inherited (for the main interpreter).  This was interfering with the logic in add_operators() (in Objects/typeobject.c), causing a wrapper to get created when it shouldn't.  This change fixes that by preserving the original data from the static type struct and checking that.

(cherry picked from commit 5250a03133, AKA gh-121602)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-11 20:47:38 +00:00
Jelle Zijlstra 38c4028dd9
[3.13] gh-121332: Make AST node constructor check _attributes instead of hardcoding attributes (GH-121334) (#121625)
(cherry picked from commit 58e8cf2bb6)
2024-07-11 15:51:32 +00:00
neonene c08a302249
[3.13] gh-117398: Use the correct module loader for iOS in datetime CAPI test (GH-120477) (#121561)
Use the correct binary module loader for iOS.
2024-07-11 06:48:53 +08:00
Miss Islington (bot) 5bb117586e
[3.13] gh-121596: Fix Sharing Interpreter Channels (gh-121600)
This fixes a mistake in gh-113012 and adds a test that verifies the fix.

(cherry picked from commit 35a67e36aa, AKA gh-121597)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-10 21:54:47 +00:00
Miss Islington (bot) 0113c56a20
[3.13] gh-107851: Fix spurious failures in fcntl eintr tests (GH-121556) (#121585)
On heavily loaded machines, the subprocess may finish its sleep before
the parent process manages to synchronize with it via a failed lock.

This leads to errors like:

  Exception: failed to sync child in 300.3 sec

Use pipes instead to mutually synchronize between parent and child.
(cherry picked from commit af9f6de6ea)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-10 15:02:26 +00:00
Miss Islington (bot) ced3fe87b0
[3.13] gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead (GH-121572) (#121574)
gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead (GH-121572)
(cherry picked from commit e2822360da)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-07-10 10:38:48 +00:00
Serhiy Storchaka 35c9399078
[3.13] Improve zipimport tests (GH-121535) (GH-121570)
(cherry picked from commit 22a0bdbf9a)
2024-07-10 13:11:39 +03:00
Miss Islington (bot) eae8fa1178
[3.13] gh-117657: Skip test when running under TSan (GH-121549) (GH-121553)
gh-117657: Skip test when running under TSan (GH-121549)

The ProcessPoolForkserver combined with resource_tracker starts a thread
after forking, which is not supported by TSan.

Also skip test_multiprocessing_fork for the same reason
(cherry picked from commit 04397434aa)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-09 21:37:30 +00:00
Miss Islington (bot) c1891e225e
[3.13] gh-121110: Fix Extension Module Tests Under Py_TRACE_REFS Builds (gh-121517)
The change in gh-118157 (b2cd54a) should have also updated clear_singlephase_extension() but didn't.  We fix that here.  Note that clear_singlephase_extension() (AKA _PyImport_ClearExtension()) is only used in tests.

(cherry picked from commit 15d48aea02, AKA gh-121503)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-08 21:34:58 +00:00
Miss Islington (bot) 2f8919ee3c
[3.13] GH-121012: Set index to -1 when list iterators become exhausted in tier 2 (GH-121483) (GH-121494) 2024-07-08 18:09:54 +01:00
Miss Islington (bot) 3e786a462c
[3.13] gh-108297: Update crashers README for test_crashers removal (#121476)
Update Lib/test/crashers/README for test_crashers removal
(cherry picked from commit 59be79ae60)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-07-08 16:54:51 +10:00
Miss Islington (bot) 2b02431dd1
[3.13] gh-121351: Skip test_not_wiping_history_file() if no readline (GH-121422) (#121449)
gh-121351: Skip test_not_wiping_history_file() if no readline (GH-121422)
(cherry picked from commit 68e279b37a)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-07-06 23:18:20 +00:00
Miss Islington (bot) c2ad5fd1d1
[3.13] gh-119909: Fix ``NameError`` in ``asyncio`` REPL (GH-121341) (#121447)
gh-119909: Fix ``NameError`` in ``asyncio`` REPL (GH-121341)
(cherry picked from commit 114389470e)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-07-07 01:02:33 +02:00
Miss Islington (bot) 4aa0c5ec34
[3.13] gh-121359: Run test_pyrepl in isolated mode (GH-121414) (#121417)
gh-121359: Run test_pyrepl in isolated mode (GH-121414)

run_repl() now pass the -I option (isolated mode) to Python if the
'env' parameter is not set.
(cherry picked from commit 6239d41527)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-05 20:55:14 +00:00
Miss Islington (bot) abefbcba8a
[3.13] gh-121084: Fix test_typing random leaks (GH-121360) (#121373)
gh-121084: Fix test_typing random leaks (GH-121360)

Clear typing ABC caches when running tests for refleaks (-R option):
call _abc_caches_clear() on typing abstract classes and their
subclasses.
(cherry picked from commit 5f660e8e2c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-04 18:07:07 +00:00
Miss Islington (bot) 65ed1b7429
[3.13] gh-117983: Defer import of threading for lazy module loading (GH-120233) (GH-121349)
gh-117983: Defer import of threading for lazy module loading (GH-120233)

As noted in gh-117983, the import importlib.util can be triggered at
interpreter startup under some circumstances, so adding threading makes
it a potentially obligatory load.
Lazy loading is not used in the stdlib, so this removes an unnecessary
load for the majority of users and slightly increases the cost of the
first lazily loaded module.

An obligatory threading load breaks gevent, which monkeypatches the
stdlib. Although unsupported, there doesn't seem to be an offsetting
benefit to breaking their use case.

For reference, here are benchmarks for the current main branch:

```
❯ hyperfine -w 8 './python -c "import importlib.util"'
Benchmark 1: ./python -c "import importlib.util"
  Time (mean ± σ):       9.7 ms ±   0.7 ms    [User: 7.7 ms, System: 1.8 ms]
  Range (min … max):     8.4 ms …  13.1 ms    313 runs
```

And with this patch:

```
❯ hyperfine -w 8 './python -c "import importlib.util"'
Benchmark 1: ./python -c "import importlib.util"
  Time (mean ± σ):       8.4 ms ±   0.7 ms    [User: 6.8 ms, System: 1.4 ms]
  Range (min … max):     7.2 ms …  11.7 ms    352 runs
```

Compare to:

```
❯ hyperfine -w 8 './python -c pass'
Benchmark 1: ./python -c pass
  Time (mean ± σ):       7.6 ms ±   0.6 ms    [User: 5.9 ms, System: 1.6 ms]
  Range (min … max):     6.7 ms …  11.3 ms    390 runs
```

This roughly halves the import time of importlib.util.
(cherry picked from commit 94f50f8ee6)

Co-authored-by: Chris Markiewicz <effigies@gmail.com>
2024-07-03 21:14:42 +00:00
Miss Islington (bot) e7008d78f3
[3.13] gh-118714: Make the pdb post-mortem restart/quit behavior more reasonable (GH-118725) (#121346)
gh-118714: Make the pdb post-mortem restart/quit behavior more reasonable (GH-118725)
(cherry picked from commit e245ed7d1e)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-07-03 12:15:53 -07:00
Miss Islington (bot) 8799f0537b
[3.13] gh-121300: Add `replace` to `copy.__all__` (GH-121302) (#121337)
(cherry picked from commit 7c66906802)

Co-authored-by: Max Muoto <maxmuoto@gmail.com>
2024-07-03 15:28:57 +00:00
Victor Stinner ec0f801a72
[3.13] gh-121279: Fix importlib DeprecatedAttrsTests (#121319)
Delete attributes after getting them, so the warning is emitted again
when the test is run multiple times (ex: when checking for reference
leaks).
2024-07-03 13:57:05 +02:00
Miss Islington (bot) 251667340e
[3.13] gh-121245: a regression test for site.register_readline() (GH-121259) (#121322) 2024-07-03 11:11:41 +00:00
Miro Hrončok dacf4ffa79
[3.13] gh-121279: Re-add prematurely removed import warnings to importlib.abc (#121281)
Fixup for 51724620e8

Fixes https://github.com/python/cpython/issues/121279
2024-07-03 11:06:20 +02:00
neonene 2c3aa527fd
[3.13] gh-120782: Update internal type cache when reloading datetime (GH-120829) (#120855)
* [3.13] gh-120782: Update internal type cache when reloading datetime

When reloading _datetime module, the single-phase version did not invoke the PyInit__datetime function, whereas the current multi-phase version updates the static types through the module init. The outdated static type cache in the interpreter state needs to be invalidated at the end of reloading the multi-phase module.
2024-07-03 13:52:51 +05:30
Miss Islington (bot) 78e96bdf24
[3.13] gh-121245: Correct pyrepl import in site.py (GH-121255) (#121261)
(cherry picked from commit 7a807c3efa)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2024-07-02 13:40:05 +02:00
Miss Islington (bot) fc0b1cbdfe
[3.13] gh-121110: Temporarily Skip test_basic_multiple_interpreters_reset_each (gh-121238)
This will allow Py_TRACE_REFS builds to pass the test suite, until the underlying issue can be resolved.

(cherry picked from commit 9bcb7d8c6f, AKA gh-121236)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-01 18:23:35 +00:00
Miss Islington (bot) 010bf92779
[3.13] gh-121200: Fix test_expanduser_pwd2() of test_posixpath (GH-121228) (#121232)
gh-121200: Fix test_expanduser_pwd2() of test_posixpath (GH-121228)

Call getpwnam() to get pw_dir, since it can be different than
getpwall() pw_dir.
(cherry picked from commit 02cb5fdee3)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-01 16:13:41 +00:00
Miss Islington (bot) 7bd67d56c4
[3.13] gh-121200: Log pwd entry in test_expanduser_pwd2() (GH-121207) (#121213)
gh-121200: Log pwd entry in test_expanduser_pwd2() (GH-121207)

Use subTest() to log the pwd entry in test_expanduser_pwd2() of
test_posixpath to help debugging.
(cherry picked from commit 05a6f8da60)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-01 10:09:01 +00:00
Miss Islington (bot) 178b5b16d3
[3.13] gh-121084: Call _abc_registry_clear() when checking refleaks (GH-121191) (#121208)
gh-121084: Call _abc_registry_clear() when checking refleaks (GH-121191)

dash_R_cleanup() now calls _abc_registry_clear() before calling again
register().
(cherry picked from commit c766ad206e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-01 09:34:53 +00:00
Miss Islington (bot) 1f2f9c4ff5
[3.13] gh-121188: Sanitize invalid XML characters in regrtest (GH-121195) (#121204)
gh-121188: Sanitize invalid XML characters in regrtest (GH-121195)

When creating the JUnit XML file, regrtest now escapes characters
which are invalid in XML, such as the chr(27) control character used
in ANSI escape sequences.
(cherry picked from commit af8c3d7a26)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-01 08:55:38 +00:00
Miss Islington (bot) d481d4b767
[3.13] gh-87744: fix waitpid race while calling send_signal in asyncio (GH-121126) (#121194)
gh-87744: fix waitpid race while calling send_signal in asyncio (GH-121126)

asyncio earlier relied on subprocess module to send signals to the process, this has some drawbacks one being that subprocess module unnecessarily calls waitpid on child processes and hence it races with asyncio implementation which internally uses child watchers. To mitigate this, now asyncio sends signals directly to the process without going through the subprocess on non windows systems. On Windows it fallbacks to subprocess module handling but on windows there are no child watchers so this issue doesn't exists altogether.

(cherry picked from commit bd473aa598)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-07-01 05:11:47 +00:00
Miss Islington (bot) 009618f112
[3.13] gh-120713: Normalize year with century for datetime.strftime (GH-120820) (GH-121144)
(cherry picked from commit 6d34938dc8)

Co-authored-by: blhsing <blhsing@gmail.com>
2024-06-29 06:57:33 +00:00
Miss Islington (bot) 58a3c3c0ad
gh-121115: Skip __index__ in PyLong_AsNativeBytes by default (GH-121118)
(cherry picked from commit 2894aa14f2)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-06-28 15:52:26 +00:00
Serhiy Storchaka 99de20d729
[3.13] gh-121018: Fix more cases of exiting in argparse when exit_on_error=False (GH-121056) (GH-121128)
* parse_intermixed_args() now raises ArgumentError instead of calling
  error() if exit_on_error is false.
* Internal code now always raises ArgumentError instead of calling
  error(). It is then caught at the higher level and error() is called if
  exit_on_error is true.
(cherry picked from commit 81a654a342)
2024-06-28 15:04:44 +00:00
Miss Islington (bot) e310d2bd71
[3.13] gh-105623 Fix performance degradation in logging RotatingFileHandler (GH-105887) (GH-121117)
The check for whether the log file is a real file is expensive on NFS
filesystems.  This commit reorders the rollover condition checking to
not do the file type check if the expected file size is less than the
rotation threshold.

(cherry picked from commit e9b4ec614b)

Co-authored-by: Craig Robson <craig@zhatt.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2024-06-28 09:23:38 +00:00
Thomas Wouters 065febe6a5 Merge branch '3.13' of https://github.com/python/cpython into 3.13 2024-06-27 20:36:45 +02:00
Miss Islington (bot) 312a32a742
[3.13] gh-119521: Remove _IncompleteInputError from the docs (GH-120993) (GH-121076)
gh-119521: Remove _IncompleteInputError from the docs (GH-120993)
(cherry picked from commit 1167a9a30b)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-06-27 15:19:20 +02:00
Thomas Wouters 7b413952e8 Python 3.13.0b3 2024-06-27 15:06:51 +02:00
Miss Islington (bot) 49e5740135
[3.13] gh-121027: Add a future warning in functools.partial.__get__ (GH-121086) (#121092)
gh-121027: Add a future warning in functools.partial.__get__ (GH-121086)
(cherry picked from commit db96edd6d1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-27 12:13:01 +00:00
Miss Islington (bot) c7d2b2b646
[3.13] gh-120888: Bump bundled pip to 24.1.1 (GH-120889) (#121080)
gh-120888: Bump bundled pip to 24.1.1 (GH-120889)
(cherry picked from commit 4999e0bda0)

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
Co-authored-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-06-27 12:53:01 +02:00
Miss Islington (bot) 9df7392eba
[3.13] gh-120868: Fix breaking change in `logging.config` when using `QueueHandler` (GH-120872) (GH-121078)
(cherry picked from commit 7d9c68513d)
2024-06-27 10:09:17 +01:00
devdanzin bc515b332b
[3.13] gh-121016: Add test for PYTHON_BASIC_REPL envioronment variable (GH-121017) (#121064)
* gh-121016: Add test for `PYTHON_BASIC_REPL` envioronment variable (#121017)

(cherry picked from commit 9e45fd9858)

* [3.13] gh-121016: Add test for `PYTHON_BASIC_REPL` envioronment variable (GH-121017)
(cherry picked from commit 9e45fd9858)

Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
2024-06-26 22:17:14 +01:00
Miss Islington (bot) 38cfa92880
[3.13] gh-118908: Use __main__ for the default PyREPL namespace (GH-121054) (#121059) 2024-06-26 19:25:38 +00:00
Miss Islington (bot) bdcc738fec
[3.13] gh-121008: Fix idlelib.run tests (GH-121046) (#121049)
gh-121008: Fix idlelib.run tests (GH-121046)

When testing IDLE, don't create a Tk to avoid side effects such as
installing a PyOS_InputHook hook.
(cherry picked from commit 44eafd6688)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-06-26 14:08:31 +00:00
Miss Islington (bot) 6bc7e2cca5
[3.13] gh-121018: Ensure ArgumentParser.parse_args with exit_on_error=False raises instead of exiting when given unrecognized arguments (GH-121019) (GH-121032)
(cherry picked from commit 0654336dd5)

Co-authored-by: blhsing <blhsing@gmail.com>
2024-06-26 10:16:19 +00:00
Miss Islington (bot) f2b4f517b9
[3.13] gh-120380: fix Python implementation of `pickle.Pickler` for `bytes` and `bytearray` objects in protocol version 5. (GH-120422) (GH-120832)
gh-120380: fix Python implementation of `pickle.Pickler` for `bytes` and `bytearray` objects in protocol version 5. (GH-120422)
(cherry picked from commit 7595e6743a)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-06-26 12:11:28 +02:00
Miss Islington (bot) 84634254fe
[3.13] gh-121025: Improve partialmethod.__repr__ (GH-121033) (#121037)
gh-121025: Improve partialmethod.__repr__ (GH-121033)

It no longer contains redundant commas and spaces.
(cherry picked from commit d2646e3f45)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-06-26 09:49:42 +00:00
Miss Islington (bot) f4f8a714b5
[3.13] gh-114053: Fix another edge case involving `get_type_hints`, PEP 695 and PEP 563 (GH-120272) (#121003)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-06-25 16:30:08 +00:00
Jelle Zijlstra 899dfbaf0e
[3.13] gh-120108: Fix deepcopying of AST trees with .parent attributes (GH-120114) (#121000)
(cherry picked from commit 42b2c9d78d)
2024-06-25 15:39:29 +00:00
Petr Viktorin 9769b7ae06
[3.13] gh-113993: Allow interned strings to be mortal, and fix related issues (GH-120520) (GH-120945)
* 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>
2024-06-24 20:24:19 +02:00
Miss Islington (bot) 447e07ab3d
[3.13] gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680, GH-120955) (GH-120944)
- gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680)
  (cherry picked from commit ce1064e4c9)

- gh-119521: Use `PyAPI_DATA`, not `extern`, for `_PyExc_IncompleteInputError` (GH-120955)
  (cherry picked from commit ac61d58db0)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-06-24 20:23:30 +02:00
Miss Islington (bot) 502a99a7e6
[3.13] gh-120373: Mark test_audit.test_http as requiring the network resource (GH-120374) (#120948)
gh-120373: Mark test_audit.test_http as requiring the network resource (GH-120374)
(cherry picked from commit b0e1c51882)

Co-authored-by: Itamar Oren <itamarost@gmail.com>
2024-06-24 13:44:06 +00:00
Miss Islington (bot) 732c00550f
[3.13] gh-119614: Fix truncation of strings with embedded null characters in Tkinter (GH-120909) (GH-120938)
Now the null character is always represented as \xc0\x80 for
Tcl_NewStringObj().
(cherry picked from commit c38e2f64d0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-24 09:45:45 +00:00
Miss Islington (bot) 544a47212b
[3.13] gh-120683: Fix an error in logging.LogRecord timestamp (GH-120709) (GH-120933)
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).
(cherry picked from commit 1500a23f33)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-24 07:14:26 +00:00
Tian Gao b7240ed3f0
[3.13] gh-119824: Revert the `where` solution and use meta commands (#120919) 2024-06-23 14:11:55 -07:00
Miss Islington (bot) 6be1048e27
[3.13] gh-120910: Fix issue resolving relative paths outside site-packages. (GH-120911) (#120917)
gh-120910: Fix issue resolving relative paths outside site-packages. (GH-120911)

Incorporates changes from importlib_metadata 7.2.1.
(cherry picked from commit 1ba0bb21ed)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-06-23 17:30:08 +00:00
Miss Islington (bot) 99f18ea689
[3.13] gh-101830: Fix Tcl_Obj to string conversion (GH-120884) (GH-120905)
Accessing the Tkinter object's string representation no longer converts
the underlying Tcl object to a string on Windows.
(cherry picked from commit f4ddaa3967)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-23 18:33:19 +03:00
Miss Islington (bot) cffead81fa
[3.13] gh-120873: Add tests for new widget options in Tk 8.7 (GH-120877) (GH-120879)
(cherry picked from commit a046c848c1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-22 13:43:30 +00:00
Miss Islington (bot) 61e6b6ab4a
[3.13] gh-120873: Add test for "state" option in ttk.Scale (GH-120874) (GH-120875)
Also refactor the "state" option tests for other ttk widgets.
(cherry picked from commit 974a978631)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-22 11:45:19 +00:00
Miss Islington (bot) 4fabbf9773
[3.13] gh-104855: Update Tkinter tests for Tcl/Tk 8.7 and 9.0 (GH-120824) (GH-120864)
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.

(cherry picked from commit 6ad26de6e8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-06-22 07:17:55 +00:00
Miss Islington (bot) f3d7823ede
[3.13] gh-120384: Fix array-out-of-bounds crash in `list_ass_subscript` (GH-120442) (#120826)
gh-120384: Fix array-out-of-bounds crash in `list_ass_subscript` (GH-120442)
(cherry picked from commit 8334a1b55c)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-06-21 11:16:24 +00:00
Mark Shannon b8fd80f91b
[3.13] GH-119462: Enforce invariants of type versioning. Backport of GH-120731. (#120748)
* Remove uses of Py_TPFLAGS_VALID_VERSION_TAG
2024-06-20 15:09:32 +01:00
Jelle Zijlstra 8cfd005b6d
[3.13] gh-119698: fix `symtable.Class.get_methods` and document its behaviour correctly (GH-120151) (#120777)
(cherry picked from commit b8a8e04fec)


Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-06-19 22:27:23 -07:00
Miss Islington (bot) 355d928e55
[3.13] gh-120732: Fix `name` passing to `Mock`, when using kwargs to `create_autospec` (GH-120737) (#120760)
gh-120732: Fix `name` passing to `Mock`, when using kwargs to `create_autospec` (GH-120737)
(cherry picked from commit 1e4815692f)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-06-19 20:59:28 +00:00
Miss Islington (bot) bb5d19440b
[3.13] gh-120635: Avoid leaking processes in test_pyrepl (GH-120676) (#120741)
gh-120635: Avoid leaking processes in test_pyrepl (GH-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.
(cherry picked from commit 0f3e36454d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-06-19 13:38:37 +00:00
Miss Islington (bot) 4ce1246a99
[3.13] gh-120722: Set position on RETURN_VALUE in lambda (GH-120724) (#120738)
(cherry picked from commit d8f27cb114)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-06-19 13:22:21 +00:00
Miss Islington (bot) 9be94f9ce6
[3.13] gh-119506: fix `_io.TextIOWrapper.write()` write during flush (GH-119507) (#119964)
gh-119506: fix `_io.TextIOWrapper.write()` write during flush (GH-119507)
(cherry picked from commit 52586f930f)

Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2024-06-19 10:11:07 +00:00
Miss Islington (bot) d65e145f9d
[3.13] gh-120449: fix ``test_pyclbr`` introspection for mangled names (GH-120450) (GH-120700)
gh-120449: fix ``test_pyclbr`` introspection for mangled names (GH-120450)
(cherry picked from commit d8cd0fa4e3)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-06-19 09:20:09 +02:00
Miss Islington (bot) 39c3f11f25
[3.13] gh-120381: Fix inspect.ismethoddescriptor() (GH-120684)
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.

(cherry picked from commit dacc5ac71a)

Co-authored-by: Jan Kaliszewski <zuo@kaliszewski.net>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-06-19 17:01:09 +10:00
Miss Islington (bot) a22eb2f266
[3.13] gh-120633: Move scrollbar and remove tear-off menus in turtledemo (GH-120634) (#120725)
gh-120633: Move scrollbar and remove tear-off menus in turtledemo (GH-120634)
(cherry picked from commit 89f7208f67)

Co-authored-by: Wulian233 <71213467+Wulian233@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-06-19 06:46:13 +00:00
Miss Islington (bot) 50fa775e68
[3.13] gh-120367: fix bug where compiler detects redundant jump after pseudo op replacement (GH-120714) (#120716) 2024-06-18 22:34:07 +00:00
Miss Islington (bot) 07145ddf19
[3.13] gh-117953: Skip `test_interpreters` properly without GIL (gh-120707)
(cherry picked from commit 1035fe0cfb, AKA gh-120689)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-06-18 16:05:30 +00:00
Miss Islington (bot) 1ce5984961
[3.13] gh-118789: Add `PyUnstable_Object_ClearWeakRefsNoCallbacks` (GH-118807) (#120695)
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.

(cherry picked from commit e8752d7b80)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-06-18 14:54:51 +00:00
Miss Islington (bot) 4f4973d740
[3.13] gh-120659: Skip `test_freethreading` with GIL (GH-120660) (#120694)
gh-120659: Skip `test_freethreading` with GIL (GH-120660)
(cherry picked from commit 360f14a493)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-06-18 14:46:29 +00:00
Miss Islington (bot) 692874cdcc
[3.13] gh-119897: Add test for lambda generator invocation (GH-120658) (#120673)
gh-119897: Add test for lambda generator invocation (GH-120658)
(cherry picked from commit 73dc1c678e)


gh-120467: Add test for lambda generator invocation

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-06-18 10:16:42 +00:00
Miss Islington (bot) 451cb71cc8
[3.13] gh-120590: Fix test_pydoc in the refleak hunting mode (GH-120615) (GH-120669)
Mocking only works if sys.modules['pydoc'] and pydoc are the same,
but some pydoc functions reload the module and change sys.modules.
Ensure that sys.modules['pydoc'] is always restored after the corresponding
tests.
(cherry picked from commit 2cf47389e2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-18 09:54:55 +00:00
Miss Islington (bot) 71ad34d219
[3.13] gh-120524: Avoid a Race On _PyRuntime.types.managed_static.types[i].interp_count (gh-120657)
gh-120182 added new global state (interp_count), but didn't add thread-safety for it.  This change eliminates the possible race.

(cherry picked from commit 2c66318cdc, AKA gh-120529)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-06-17 16:13:40 -06:00
Miss Islington (bot) 396f8b0b98
[3.13] gh-117657: Fix `__slots__` thread safety in free-threaded build (GH-119368) (#120655)
Fix a race in `PyMember_GetOne` and `PyMember_SetOne` for `Py_T_OBJECT_EX`.
These functions implement `__slots__` accesses for Python objects.
(cherry picked from commit 362cd2680b)

Co-authored-by: Daniele Parmeggiani <8658291+dpdani@users.noreply.github.com>
2024-06-17 19:12:25 +00:00
Miss Islington (bot) 9172bc35c6
[3.13] gh-115649: Copy the filename into main interpreter before intern in import.c (GH-120315) (#120652)
gh-115649: Copy the filename into main interpreter before intern in import.c (GH-120315)
(cherry picked from commit 28140d1f2d)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-06-17 22:30:26 +05:30
Miss Islington (bot) 61a2229005
[3.13] gh-120367: fix removal of redundant NOPs and jumps after reordering hot-cold blocks (GH-120425) (#120621)
gh-120367: fix removal of redundant NOPs and jumps after reordering hot-cold blocks (GH-120425)
(cherry picked from commit 21866c8ed2)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-06-17 16:07:20 +01:00
Jelle Zijlstra 7c47f93dff
[3.13] gh-119933: Improve ``SyntaxError`` message for invalid type parameters expressions (GH-119976) (#120641)
(cherry picked from commit 4bf17c381f)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-06-17 08:01:49 -07:00
Miss Islington (bot) aa39ba0af3
[3.13] gh-120567: Clarify weekday return in calendar.monthrange docstring (GH-120570) (#120597)
gh-120567: Clarify weekday return in calendar.monthrange docstring (GH-120570)
(cherry picked from commit bd4516d9ef)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-16 21:09:54 +00:00
Tian Gao 1c41aa78d8
[3.13] gh-119824: Print stack entry when user input is needed (GH-119882) (#120533)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-06-16 12:05:07 -07:00
Miss Islington (bot) f2a4540c4f
[3.13] gh-120579: Guard `_testcapi` import in `test_free_threading` (GH-120580) (#120583)
gh-120579: Guard `_testcapi` import in `test_free_threading` (GH-120580)
(cherry picked from commit 0c0348adbf)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-06-16 08:50:33 +00:00
Miss Islington (bot) a19bb261a3
[3.13] gh-112346: Always set OS byte to 255, simpler gzip.compress function. (GH-120486) (#120563)
gh-112346: Always set OS byte to 255, simpler gzip.compress function. (GH-120486)

This matches the output behavior in 3.10 and earlier; the optimization in 3.11 allowed the zlib library's "os" value to be filled in instead in the circumstance when mtime was 0.  this keeps things consistent.
(cherry picked from commit 08d09cf5ba)

Co-authored-by: Ruben Vorderman <r.h.p.vorderman@lumc.nl>
2024-06-15 19:10:50 +00:00
Miss Islington (bot) 3a9f438c92
[3.13] gh-120541: Improve the "less" prompt in pydoc (GH-120543) (GH-120562)
When help() is called with non-string argument, use __qualname__ or
__name__ if available, otherwise use "{typename} object".
(cherry picked from commit 31d1d72d7e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-15 18:21:13 +00:00
Miss Islington (bot) 13a5082afe
[3.13] Add some more edge-case tests for `inspect.get_annotations` with `eval_str=True` (GH-120550) (#120551)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-06-15 13:16:40 +00:00
Miss Islington (bot) 767c955544
[3.13] gh-120544: Add `else: fail()` to tests where exception is expected (GH-120545) (#120546)
gh-120544: Add `else: fail()` to tests where exception is expected (GH-120545)
(cherry picked from commit 42ebdd83bb)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-06-15 12:54:07 +01:00
Miss Islington (bot) e54a28bcc9
[3.13] gh-120495: Fix incorrect exception handling in Tab Nanny (GH-120498) (#120548)
gh-120495: Fix incorrect exception handling in Tab Nanny (GH-120498)
(cherry picked from commit c501261c91)

Co-authored-by: Wulian233 <71213467+Wulian233@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-15 11:28:28 +00:00
Miss Islington (bot) 3c88898a69
[3.13] gh-119819: Conditional skip of logging tests that require multiprocessing subprocess support (GH-120476) (#120531)
gh-119819: Conditional skip of logging tests that require multiprocessing subprocess support (GH-120476)

Skip tests that require multiprocessing subprocess support.
(cherry picked from commit 92f6d400f7)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2024-06-15 08:32:22 +08:00
Eric Snow f021f9e50e
[3.13] gh-120524: Temporarily Skip test_create_many_threaded In test_interpreters.test_stress (gh-120527) 2024-06-14 22:14:29 +00:00
Miss Islington (bot) 18ea22a830
[3.13] gh-120161: Fix a Crash in the _datetime Module (gh-120518)
In gh-120009 I used an atexit hook to finalize the _datetime module's static types at interpreter shutdown.  However, atexit hooks are executed very early in finalization, which is a problem in the few cases where a subclass of one of those static types is still alive until the final GC collection.  The static builtin types don't have this probably because they are finalized toward the end, after the final GC collection.  To avoid the problem for _datetime, I have applied a similar approach here.

Also, credit goes to @mgorny and @neonene for the new tests.

FYI, I would have liked to take a slightly cleaner approach with managed static types, but wanted to get a smaller fix in first for the sake of backporting.  I'll circle back to the cleaner approach with a future change on the main branch.

(cherry picked from commit b2e71ff4f8, AKA gh-120182)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-06-14 19:54:46 +00:00
Miss Islington (bot) da40fa3526
[3.13] gh-120361: Add `nonmember` test with enum flags inside to `test_enum` (GH-120364) (#120511)
gh-120361: Add `nonmember` test with enum flags inside to `test_enum` (GH-120364)

* gh-120361: Add `nonmember` test with enum flags inside to `test_enum`
(cherry picked from commit 7fadfd82eb)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-06-14 22:08:21 +03:00
Miss Islington (bot) d4174fa7ca
[3.13] gh-114053: Fix bad interaction of PEP 695, PEP 563 and `inspect.get_annotations` (GH-120270) (#120474)
gh-114053: Fix bad interaction of PEP 695, PEP 563 and `inspect.get_annotations` (GH-120270)
(cherry picked from commit 42351c3b9a)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-06-13 21:41:14 +00:00
Miss Islington (bot) 15c3d0013d
[3.13] gh-117398: Add datetime C-API type check test for subinterpreters (gh-120463)
Check if the DateTime C-API type matches the datetime.date type on main and shared/isolated subinterpreters.

(cherry picked from commit 50a389565a, AKA gh-119604)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2024-06-13 18:30:42 +00:00
Xie Yanbo 9c7ac7d041
[3.13] Fix typos in documentation (GH-120338) (#120438)
(cherry picked from commit ce3879bd45)
2024-06-13 09:39:46 +03:00
Miss Islington (bot) ff358616dd
[3.13] gh-118908: Protect the REPL subprocess with a timeout in tests (GH-120408) (#120430)
(cherry picked from commit 3453362183)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-06-12 21:58:29 +02:00
Miss Islington (bot) f7237284b9
[3.13] gh-120418: Don't assume wheeldata is deleted if `WHEEL_PKG_DIR` is set (GH-120419) (#120432)
gh-120418: Don't assume wheeldata is deleted if `WHEEL_PKG_DIR` is set (GH-120419)

Remove wheeldata from both sides of the `assertEqual`, so that we're
*actually* ignoring it from the test set.

This test is only making assertions about the source tree, no code is
being executed that would do anything different based on the value of
`WHEEL_PKG_DIR`.
(cherry picked from commit 030b452e34)

Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
2024-06-12 19:51:55 +00:00
Miss Islington (bot) 51724620e8
[3.13] gh-120417: Remove unused imports in the stdlib (GH-120420) (#120429)
gh-120417: Remove unused imports in the stdlib (GH-120420)
(cherry picked from commit 4c6d4f5cb3)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-06-12 19:27:32 +00:00
Miss Islington (bot) 7c6b3429b6
[3.13] gh-120343: Fix column offsets of multiline tokens in tokenize (GH-120391) (#120427)
(cherry picked from commit 4b5d3e0e72)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2024-06-12 19:22:44 +00:00
Miss Islington (bot) 0041087aa1
[3.13] gh-71587: Drop local reference cache to `_strptime` module in `_datetime` (gh-120424)
The _strptime module object was cached in a static local variable (in the datetime.strptime() implementation).  That's a problem when it crosses isolation boundaries, such as reinitializing the runtme or between interpreters.  This change fixes the problem by dropping the static variable, instead always relying on the normal sys.modules cache (via PyImport_Import()).

(cherry picked from commit 127c1d2771, AKA gh-120224)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2024-06-12 17:15:16 +00:00
Miss Islington (bot) 91c4444d22
[3.13] gh-117657: Make Py_TYPE and Py_SET_TYPE thread safe (GH-120165) (GH-120403)
gh-117657: Make Py_TYPE and Py_SET_TYPE thread safe (GH-120165)
(cherry picked from commit e16aed63f6)

Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
2024-06-12 21:37:26 +08:00
Miss Islington (bot) 39825a7533
[3.13] gh-93691: fix too broad source locations of for statement iterators (GH-120330) (#120399)
gh-93691: fix too broad source locations of for statement iterators (GH-120330)
(cherry picked from commit 97b69db167)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-06-12 12:18:43 +00:00
Miss Islington (bot) 10821ccf06
[3.13] gh-118908: Fix completions after namespace change in REPL (GH-120370) (#120392)
(cherry picked from commit 02e74c3562)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2024-06-12 08:48:22 +00:00
Miss Islington (bot) 8f5ce42f34
[3.13] gh-120128: fix description of argument to ipaddress.collapse_addresses() (GH-120131) (#120135)
gh-120128: fix description of argument to ipaddress.collapse_addresses() (GH-120131)

The argument to collapse_addresses() is now described as an *iterable*
(rather than *iterator*).
(cherry picked from commit f878d46e56)

Co-authored-by: Jan Kaliszewski <zuo@kaliszewski.net>
2024-06-12 09:23:24 +03:00
Miss Islington (bot) 7aafa305d4
[3.13] gh-120221: Deliver real singals on Ctrl-C and Ctrl-Z in the new REPL (GH-120354) (#120368) 2024-06-11 19:46:07 +00:00
Miss Islington (bot) a6c4080aaa
gh-120198: Fix race condition when editing __class__ with an audit hook active (GH-120195)
(cherry picked from commit 203565b2f9)

Co-authored-by: Ken Jin <kenjin@python.org>
2024-06-11 19:35:49 +00:00
Miss Islington (bot) f5289c450a
[3.13] gh-118908: Limit exposed globals from internal imports and definitions on new REPL startup (GH-119547) (#120362) 2024-06-11 18:04:39 +00:00
Miss Islington (bot) 51bcb67405
[3.13] gh-120343: Do not reset byte_col_offset_diff after multiline tokens (GH-120352) (#120355)
(cherry picked from commit 1b62bcee94)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-06-11 17:25:57 +00:00
Miss Islington (bot) 4936575017
[3.13] gh-119517: Fixes for pasting in pyrepl (GH-120253) (#120353)
gh-119517: Fixes for pasting in pyrepl (GH-120253)

* Remove pyrepl's optimization for self-insert

This will be replaced by a less specialized optimization.

* Use line-buffering when pyrepl echoes pastes

Previously echoing was totally suppressed until the entire command had
been pasted and the terminal ended paste mode, but this gives the user
no feedback to indicate that an operation is in progress. Drawing
something to the screen once per line strikes a balance between
perceived responsiveness and performance.

* Remove dead code from pyrepl

`msg_at_bottom` is always true.

* Speed up pyrepl's screen rendering computation

The Reader in pyrepl doesn't hold a complete representation of the
screen area being drawn as persistent state. Instead, it recomputes it,
on each keypress. This is fast enough for a few hundred bytes, but
incredibly slow as the input buffer grows into the kilobytes (likely
because of pasting).

Rather than making some expensive and expansive changes to the repl's
internal representation of the screen, add some caching: remember some
data from one refresh to the next about what was drawn to the screen
and, if we don't find anything that has invalidated the results that
were computed last time around, reuse them. To keep this caching as
simple as possible, all we'll do is look for lines in the buffer that
were above the cursor the last time we were asked to update the screen,
and that are still above the cursor now. We assume that nothing can
affect a line that comes before both the old and new cursor location
without us being informed. Based on this assumption, we can reuse old
lines, which drastically speeds up the overwhelmingly common case where
the user is typing near the end of the buffer.

* Speed up pyrepl prompt drawing

Cache the `can_colorize()` call rather than repeatedly recomputing it.
This call looks up an environment variable, and is called once per
character typed at the REPL. The environment variable lookup shows up as
a hot spot when profiling, and we don't expect this to change while the
REPL is running.

* Speed up pasting multiple lines into the REPL

Previously, we were checking whether the command should be accepted each
time a line break was encountered, but that's not the expected behavior.
In bracketed paste mode, we expect everything pasted to be part of
a single block of code, and encountering a newline shouldn't behave like
a user pressing <Enter> to execute a command. The user should always
have a chance to review the pasted command before running it.

* Use a read buffer for input in pyrepl

Previously we were reading one byte at a time, which causes much slower
IO than necessary. Instead, read in chunks, processing previously read
data before asking for more.

* Optimize finding width of a single character

`wlen` finds the width of a multi-character string by adding up the
width of each character, and then subtracting the width of any escape
sequences. It's often called for single character strings, however,
which can't possibly contain escape sequences. Optimize for that case.

* Optimize disp_str for ASCII characters

Since every ASCII character is known to display as single width, we can
avoid not only the Unicode data lookup in `disp_str` but also the one
hidden in `str_width` for them.

* Speed up cursor movements in long pyrepl commands

When the current pyrepl command buffer contains many lines, scrolling up
becomes slow. We have optimizations in place to reuse lines above the
cursor position from one refresh to the next, but don't currently try to
reuse lines below the cursor position in the same way, so we wind up
with quadratic behavior where all lines of the buffer below the cursor
are recomputed each time the cursor moves up another line.

Optimize this by only computing one screen's worth of lines beyond the
cursor position. Any lines beyond that can't possibly be shown by the
console, and bounding this makes scrolling up have linear time
complexity instead.

---------

(cherry picked from commit 32a0faba43)

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2024-06-11 17:09:28 +00:00
Miss Islington (bot) 64a61ca13c
[3.13] gh-120268: Prohibit passing ``None`` to ``_pydatetime.date.fromtimestamp`` (GH-120269) (GH-120282)
This makes the pure Python implementation consistent with the C implementation.
(cherry picked from commit 34f5ae69fe)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-06-11 12:54:02 +03:00
Miss Islington (bot) f386cc9620
[3.13] bpo-24766: doc= argument to subclasses of property not handled correctly (GH-2487) (GH-120305)
(cherry picked from commit 4829522b8d)

Co-authored-by: E. M. Bray <erik.bray@lri.fr>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-11 12:52:27 +03:00
Miss Islington (bot) 52225c64f7
[3.13] gh-120298: Fix use-after-free in `list_richcompare_impl` (GH-120303) (#120340)
gh-120298: Fix use-after-free in `list_richcompare_impl` (GH-120303)
(cherry picked from commit 141babad9b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-11 07:28:45 +00:00
Miss Islington (bot) 81eae21733
[3.13] gh-65454: avoid triggering call to a PropertyMock in NonCallableMock.__setattr__ (GH-120019) (#120336)
gh-65454: avoid triggering call to a PropertyMock in NonCallableMock.__setattr__ (GH-120019)
(cherry picked from commit 9e9ee50421)

Co-authored-by: blhsing <blhsing@gmail.com>
2024-06-11 06:12:16 +00:00
Miss Islington (bot) aba5f2a4d1
[3.13] gh-119600: mock: do not access attributes of original when new_callable is set (GH-119601) (#120334)
gh-119600: mock: do not access attributes of original when new_callable is set (GH-119601)

In order to patch flask.g e.g. as in GH-84982, that
proxies getattr must not be invoked. For that,
mock must not try to read from the original
object. In some cases that is unavoidable, e.g.
when doing autospec. However, patch("flask.g",
new_callable=MagicMock) should be entirely safe.
(cherry picked from commit 422c4fc855)

Co-authored-by: Robert Collins <robert.collins@cognite.com>
2024-06-11 06:04:06 +00:00
Miss Islington (bot) 03cd44759f
[3.13] gh-119666: fix multiple class-scope comprehensions referencing __class__ (GH-120295) (#120299) 2024-06-10 00:37:28 -04:00
Miss Islington (bot) c15f94d6fb
[3.13] bpo-37755: Use configured output in pydoc instead of pager (GH-15105) (GH-120261)
If the Helper() class was initialized with an output, the topics, keywords
and symbols help still use the pager instead of the output.
Change the behavior so  the output is used if available while keeping the
previous behavior if no output was configured.
(cherry picked from commit 2080425154)

Co-authored-by: Enrico Tröger <enrico.troeger@uvena.de>
2024-06-08 17:48:47 +00:00
Miss Islington (bot) 4bca4e58af
[3.13] gh-120121: Add InvalidStateError to concurrent.futures.__all__ (GH-120123) (#120273)
gh-120121: Add InvalidStateError to concurrent.futures.__all__ (GH-120123)
(cherry picked from commit 5d59b870ef)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-06-08 16:35:10 +00:00
Miss Islington (bot) 863a0bd515
[3.13] gh-120242: Fix handling of `[setUp,tearDown]Class` in `test_datetime` (GH-120243) (#120259)
gh-120242: Fix handling of `[setUp,tearDown]Class` in `test_datetime` (GH-120243)
(cherry picked from commit 95f4db88d5)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-06-08 08:13:53 +00:00
Miss Islington (bot) 3be7e91d03
[3.13] gh-120225: fix crash in compiler on empty block at end of exception handler (GH-120235) (#120249)
gh-120225: fix crash in compiler on empty block at end of exception handler (GH-120235)
(cherry picked from commit 4fc82b6d3b)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-06-07 22:01:20 +00:00
Miss Islington (bot) 6238174e47
[3.13] gh-120200: Fix `inspect.iscoroutinefunction(inspect) is True` corner case (GH-120214) (#120237)
gh-120200: Fix `inspect.iscoroutinefunction(inspect) is True` corner case (GH-120214)
(cherry picked from commit 10fb1b8f36)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-06-07 19:26:30 +03:00
Miss Islington (bot) 18359f202d
[3.13] gh-94808: Add test coverage for "starred kind" in _PyPegen_set_expr_context (GH-119222) (GH-119263)
gh-94808: Add test coverage for "starred kind" in _PyPegen_set_expr_context (GH-119222)

Add test coverage for "starred kind" in _PyPegen_set_expr_context
(cherry picked from commit 8231a24454)

Co-authored-by: Mark Jason Dominus (陶敏修) <mjd@pobox.com>
2024-06-07 16:11:20 +00:00
Miss Islington (bot) 8368b67d1b
[3.13] gh-120211: Fix tkinter.ttk with Tcl/Tk 9.0 (GH-120213) (GH-120215)
* Use new methods for tracing Tcl variable.
* Fix Combobox.current() for empty combobox.
(cherry picked from commit d68a22e7a6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-07 15:00:30 +00:00
Miss Islington (bot) 1e43f76b76
[3.13] gh-120164: Fix test_os.test_win32_mkdir_700() (GH-120177) (#120202)
gh-120164: Fix test_os.test_win32_mkdir_700() (GH-120177)

Don't compare the path to avoid encoding issues.

(cherry picked from commit d5ba4fc9bc)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Eryk Sun <eryksun@gmail.com>
2024-06-07 09:39:56 +00:00
Miss Islington (bot) 56a7e04834
[3.13] gh-119577: Adjust DeprecationWarning when testing element truth values in ElementTree (GH-119762) (GH-120189)
gh-119577: Adjust DeprecationWarning when testing element truth values in ElementTree (GH-119762)

Adjust DeprecationWarning when testing element truth values in ElementTree, we're planning to go with the more natural True return rather than a disruptive harder to code around exception raise, and are deferring the behavior change for a few more releases.
(cherry picked from commit 6b606522ca)

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2024-06-07 03:43:17 +00:00
Miss Islington (bot) 015ddfeca5
[3.13] Restore decimal context after decimal doctests (GH-120149) (GH-120167)
The modified context caused tests failures in several other tests.
(cherry picked from commit 2d7ff6e0e7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-06 17:36:46 +00:00
Thomas Wouters 3a83b172af Python 3.13.0b2 2024-06-05 16:46:34 +02:00
Miss Islington (bot) f561258efd
[3.13] gh-120065: Increase `collect_in_thread` period to 5 ms. (GH-120068) (#120110)
This matches the default GIL switch interval. It greatly speeds up the
free-threaded build: previously, it spent nearly all its time in
`gc.collect()`.
(cherry picked from commit 4bba1c9e6c)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-06-05 13:46:17 +00:00
Miss Islington (bot) 71f86eedeb
[3.13] gh-119819: Update logging configuration to support joinable multiproc… (GH-120090) (GH-120093)
(cherry picked from commit 983efcf15b)
2024-06-05 07:59:41 +01:00
Miss Islington (bot) 4ac0ccf9d3
[3.13] gh-119553: Fix console when pressing Ctrl-C within a multiline block (GH-120075) (#120076)
(cherry picked from commit 69b3e8ea56)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2024-06-04 21:44:33 +00:00
Miss Islington (bot) a9e807fe44
[3.13] gh-120048: Make `test_imaplib` faster (GH-120050) (#120069)
The `test_imaplib` was taking 40+ minutes in the refleak build bots because
the tests waiting on a client `self._setup()` was creating a client that
prevented progress until its connection timed out, which scaled with the
global timeout.

We should set `connect=False` for the tests that don't want `_setup()` to
create a client.

(cherry picked from commit 710cbea660)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-04 20:18:33 +00:00
Miss Islington (bot) 7edc6bd627
[3.13] gh-119819: Update test to skip if _multiprocessing is unavailable. (GH-120067) (GH-120072)
(cherry picked from commit 109e1082ea)
2024-06-04 20:50:48 +01:00
Łukasz Langa eea45ea213
[3.13] gh-119842: Honor PyOS_InputHook in the new REPL (GH-119843) (GH-120066)
(cherry picked from commit d9095194dd)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2024-06-04 21:26:10 +02:00
Miss Islington (bot) 93b95e91fa
[3.13] gh-119553: Clear reader on Ctrl-C command (GH-119801) (#120062)
(cherry picked from commit 010ea93b2b)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-06-04 18:45:22 +00:00
Miss Islington (bot) fd5428d2d1
[3.13] gh-120039: Reduce expected timeout in test_siginterrupt_off (GH-120047) (#120060)
The process is expected to time out. In the refleak builds,
`support.SHORT_TIMEOUT` is often five minutes and we run the tests six
times, so test_signal was taking >30 minutes.
(cherry picked from commit d419d468ff)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-06-04 18:11:01 +00:00
Miss Islington (bot) 8d74eae4d4
[3.13] gh-120041: Do not use append_to_screen when completions are visible (GH-120042) (#120051)
* gh-120041: Do not use append_to_screen when completions are visible (GH-120042)
(cherry picked from commit 8fc7653766)

* gh-120041: Refactor check for visible completion menu in completing_reader (GH-120055)
(cherry picked from commit bf8e5e53d0)
---------

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2024-06-04 18:10:29 +00:00
Miss Islington (bot) 2acbdc23ad
[3.13] gh-89928: Fix integer conversion of device numbers (GH-31794) (GH-120053)
Fix os.major(), os.minor() and os.makedev().
Support device numbers larger than 2**63-1.
Support non-existent device number (NODEV).
(cherry picked from commit 7111d9605f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-04 17:19:13 +00:00
Miss Islington (bot) 34a6d89788
[3.13] gh-119588: Implement zipfile.Path.is_symlink (zipp 3.19.0). (GH-119591) (#119985)
gh-119588: Implement zipfile.Path.is_symlink (zipp 3.19.0). (GH-119591)
(cherry picked from commit 42a34ddb0b)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-06-04 10:56:06 -04:00
Miss Islington (bot) 23ebf87eaa
[3.13] gh-106531: Apply changes from importlib_resources 6.3.2 (GH-117054) (#120014)
gh-106531: Apply changes from importlib_resources 6.3.2 (GH-117054)

Apply changes from importlib_resources 6.3.2.
(cherry picked from commit 8d63c8d47b)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-06-04 10:54:59 -04:00
Miss Islington (bot) 720a44d414
[3.13] gh-119819: Fix regression to allow logging configuration with multipr… (GH-120030) (GH-120035)
(cherry picked from commit 99d945c0c0)
2024-06-04 13:46:41 +01:00
Miss Islington (bot) feaecf8c33
[3.13] gh-118868: logging QueueHandler fix passing of kwargs (GH-118869) (GH-120032)
(cherry picked from commit dce14bb2dc)
2024-06-04 13:18:11 +01:00
Miss Islington (bot) 6ce2810f36
[3.13] gh-119070: Update test_shebang_executable_extension to always use non-installed version (GH-119846) (#GH-120015)
gh-119070: Update test_shebang_executable_extension to always use non-installed version (GH-119846)
(cherry picked from commit 5c48eb0cc6)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-06-04 13:24:10 +02:00
T. Wouters 6be55f1bed
[3.13] gh-119724: Revert "bpo-45759: Better error messages for non-matching 'elif'/'else' statements (GH-29513)" (GH-119974) (GH-120013)
This reverts commit 1c8f912ebd.
(cherry picked from commit 31a4fb3c74)
2024-06-04 08:36:16 +02:00
Sam Gross 79fae3b0a1
[3.13] gh-117657: Fix itertools.count thread safety (GH-119268) (#120007)
Fix itertools.count in free-threading mode
(cherry picked from commit 87939bd579)

Co-authored-by: Arnon Yaari <wiggin15@yahoo.com>
2024-06-03 22:47:34 +00:00
Sam Gross ae705319fc
[3.13] gh-117657: Fix race involving immortalizing objects (GH-119927) (#120005)
The free-threaded build currently immortalizes objects that use deferred
reference counting (see gh-117783). This typically happens once the
first non-main thread is created, but the behavior can be suppressed for
tests, in subinterpreters, or during a compile() call.

This fixes a race condition involving the tracking of whether the
behavior is suppressed.

(cherry picked from commit 47fb4327b5)
2024-06-03 22:21:32 +00:00
Miss Islington (bot) 6b10467fbc
[3.13] gh-118835: pyrepl: Fix prompt length computation for custom prompts containing ANSI escape codes (GH-119942) (#119990)
gh-118835: pyrepl: Fix prompt length computation for custom prompts containing ANSI escape codes (GH-119942)
(cherry picked from commit 2e0aa731ae)

Co-authored-by: Daniel Hollas <daniel.hollas@bristol.ac.uk>
2024-06-03 17:31:26 +00:00
Miss Islington (bot) 060d846f43
[3.13] Use Cirrus M1 macOS runners for CI (GH-119979) (GH-119986)
(cherry picked from commit 6acb32fac3)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Ee Durbin <ee@python.org>
2024-06-03 18:15:37 +02:00
Miss Islington (bot) c3fc3a2db8
[3.13] gh-119856: Support exiting help() with just "exit" (GH-119858) (#119967)
gh-119856: Support exiting help() with just "exit" (GH-119858)
(cherry picked from commit 4223f1d828)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-06-03 09:10:39 +00:00
Victor Stinner ac35d9621b
[3.13] gh-111201: Skip pyrepl Windows tests earlier (#119848) (#119924)
gh-111201: Skip pyrepl Windows tests earlier (#119848)

Don't attempt to load pyrepl Windows console if platforms others than
Windows. For example, the import can fail if ctypes is missing.

(cherry picked from commit 91601a5596)
2024-06-01 21:21:13 +00:00
Miss Islington (bot) 225c3cd6c1
[3.13] GH-89727: Fix `shutil.rmtree()` recursion error on deep trees (GH-119808) (#119918)
Implement `shutil._rmtree_safe_fd()` using a list as a stack to avoid emitting recursion errors on deeply nested trees.

`shutil._rmtree_unsafe()` was fixed in a150679f90.

(cherry picked from commit 53b1981fb0)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-06-01 20:38:55 +01:00
Miss Islington (bot) 0ea77d49cc
[3.13] gh-113892: Add a extra check to `ProactorEventLoop.sock_connect` to ensure that the given socket is in non-blocking mode (GH-119519) (#119912)
(cherry picked from commit cf3bba3f06)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-06-01 16:27:54 +00:00
Jelle Zijlstra a0559849ac
[3.13] gh-119821: Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS (#119822) (#119889)
dSupport non-dict globals in LOAD_FROM_DICT_OR_GLOBALS

The implementation basically copies LOAD_GLOBAL. Possibly it could be deduplicated,
but that seems like it may get hairy since the two operations have different operands.

This is important to fix in 3.14 for PEP 649, but it's a bug in earlier versions too,
and we should backport to 3.13 and 3.12 if possible.

(cherry picked from commit 80a4e38994)
2024-05-31 21:56:26 -07:00
Miss Islington (bot) 0a266f7e74
[3.13] gh-74929: PEP 667 C API documentation (gh-119892)
* Add docs for new APIs
* Add soft-deprecation notices
* Add What's New porting entries
* Update comments referencing `PyFrame_LocalsToFast()` to mention the proxy instead
* Other related cleanups found when looking for refs to the deprecated APIs

(cherry picked from commit 3859e09e3d)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-06-01 04:23:04 +00:00
Miss Islington (bot) a5272e63ef
[3.13] gh-118894: Make asyncio REPL use pyrepl (GH-119433) (#119884)
(cherry picked from commit 2237946af0)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-31 17:15:44 -04:00
Miss Islington (bot) 8e0777df1f
gh-119690: Adds Unicode support for named pipes in _winapi (GH-119717)
(cherry picked from commit 78d697b7d5)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-05-31 16:22:30 +00:00
Miss Islington (bot) ea48de4f4f
[3.13] gh-119585: Fix crash involving `PyGILState_Release()` and `PyThreadState_Clear()` (GH-119753) (#119859)
Make sure that `gilstate_counter` is not zero in when calling
`PyThreadState_Clear()`. A destructor called from `PyThreadState_Clear()` may
call back into `PyGILState_Ensure()` and `PyGILState_Release()`. If
`gilstate_counter` is zero, it will try to create a new thread state before
the current active thread state is destroyed, leading to an assertion failure
or crash.
(cherry picked from commit bcc1be39cb)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-05-31 15:29:50 +00:00
Miss Islington (bot) d6faac6d1f
[3.13] gh-111201: Support pyrepl on Windows (GH-119559) (GH-119850)
(cherry picked from commit 0d07182821)

Co-authored-by: Dino Viehland <dinoviehland@gmail.com>
Co-authored-by: Anthony Shaw <anthony.p.shaw@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-31 17:18:28 +02:00
Miss Islington (bot) 38bf39cb4b
[3.13] gh-111201: Improve pyrepl auto indentation (GH-119606) (GH-119833)
- auto-indent when editing multi-line block
- ignore comments

(cherry picked from commit dae0375bd9)

Co-authored-by: Arnon Yaari <wiggin15@yahoo.com>
2024-05-31 11:51:53 +02:00
Miss Islington (bot) 8470593a98
[3.13] gh-119548: Add a 'clear' command to the REPL (GH-119549) (#119552)
gh-119548: Add a 'clear' command to the REPL (GH-119549)
(cherry picked from commit e3bac04c37)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-05-31 08:35:21 +00:00
Miss Islington (bot) 978b86a91e
[3.13] gh-107262: Update Tkinter tests for Tcl/Tk 8.6.14 (GH-119322) (GH-119806)
(cherry picked from commit 9732ed5ca9)

Co-authored-by: James De Bias <81095953+DBJim@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-30 21:16:35 +00:00
Miss Islington (bot) d6bede815d
[3.13] gh-119791: Fix new Tkinter tests for wantobjects=0 (GH-119792) (GH-119794)
PhotoImage.get() retruns a string instead of a 3-tuple of integers
in this case.
(cherry picked from commit e875c2d752)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-30 19:16:57 +00:00
Miss Islington (bot) 083bf3ad17
[3.13] GH-89727: Fix FD leak on `os.fwalk()` generator finalization. (GH-119766) (#119767)
GH-89727: Fix FD leak on `os.fwalk()` generator finalization. (GH-119766)

Follow-up to 3c890b50. Ensure we `os.close()` open file descriptors when
the `os.fwalk()` generator is finalized.
(cherry picked from commit a5fef800d3)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-05-30 04:40:21 +00:00
Miss Islington (bot) 810a09ad37
[3.13] GH-89727: Fix `os.fwalk()` recursion error on deep trees (GH-119638) (#119764)
GH-89727: Fix `os.fwalk()` recursion error on deep trees (GH-119638)

Implement `os.fwalk()` using a list as a stack to avoid emitting recursion
errors on deeply nested trees.
(cherry picked from commit 3c890b503c)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-05-30 03:28:55 +00:00
Miss Islington (bot) 06c62d697a
[3.13] gh-119260: Clarify is_dataclass Behavior for Subclasses in Documentation and Tests (GH-119480) (#119760)
gh-119260: Clarify is_dataclass Behavior for Subclasses in Documentation and Tests (GH-119480)
(cherry picked from commit bf4ff3ad2e)

Co-authored-by: Aditya Borikar <adityaborikar2@gmail.com>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2024-05-30 01:28:31 +00:00
Eric Snow af57832e63
[3.13] gh-117398: Add multiphase support to _datetime (gh-119694)
This is an unrevert of d58ebf0 (gh-119636), which was reverted by 9216a53 (gh-119639) due to problems which have been resolved.

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

(cherry picked from commit 3e8b609)

Co-authored-by: Erlend E. Aasland erlend@python.org
2024-05-29 15:54:47 -06:00
Miss Islington (bot) a7aa7c41eb
[3.13] GH-119169: Implement `pathlib.Path.walk()` using `os.walk()` (GH-119573) (#119750)
GH-119169: Implement `pathlib.Path.walk()` using `os.walk()` (GH-119573)

For silly reasons, pathlib's generic implementation of `walk()` currently
resides in `glob._Globber`. This commit moves it into
`pathlib._abc.PathBase.walk()` where it really belongs, and makes
`pathlib.Path.walk()` call `os.walk()`.
(cherry picked from commit 7ff61f51b6)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-05-29 21:24:42 +00:00
Miss Islington (bot) 061abf8e4c
[3.13] GH-89727: Partially fix `shutil.rmtree()` recursion error on deep trees (GH-119634) (#119748)
GH-89727: Partially fix `shutil.rmtree()` recursion error on deep trees (GH-119634)

Make `shutil._rmtree_unsafe()` call `os.walk()`, which is implemented
without recursion.

`shutil._rmtree_safe_fd()` is not affected and can still raise a recursion
error.

(cherry picked from commit a150679f90)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-05-29 20:41:03 +00:00
Miss Islington (bot) c3cfc04a73
gh-119070: Fix py.exe handling of /usr/bin/env commands missing extension (GH-119426)
(cherry picked from commit df93f5d4bf)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-05-29 20:06:38 +00:00
Miss Islington (bot) 40a024c983
[3.13] gh-119555: catch SyntaxError from compile() in the InteractiveColoredConsole (GH-119557) (#119709) 2024-05-29 12:04:45 +01:00
Miss Islington (bot) 17d3398486
[3.13] gh-119443: Turn off from __future__ import annotations in REPL (GH-119493) (#119697)
gh-119443: Turn off from __future__ import annotations in REPL (GH-119493)
(cherry picked from commit a8e35e8eba)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-05-29 01:26:19 +00:00
Miss Islington (bot) c0e9961798
[3.13] gh-119011: `type.__type_params__` now return an empty tuple (GH-119296) (#119678)
(cherry picked from commit 6b240c2308)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-28 19:09:04 +00:00
Jelle Zijlstra 6394a72e99
[3.13] gh-119311: Fix name mangling with PEP 695 generic classes (#119464) (#119643)
Fixes #119311. Fixes #119395.

(cherry picked from commit a9a74da4a0)
2024-05-28 11:03:33 -07:00
Miss Islington (bot) 2b46253c5f
[3.13] gh-119581: Add a test of InitVar with name shadowing (GH-119582) (#119672)
gh-119581: Add a test of InitVar with name shadowing (GH-119582)
(cherry picked from commit 6ec371223d)

Co-authored-by: Steven Troxler <steven.troxler@gmail.com>
2024-05-28 17:41:02 +00:00
Miss Islington (bot) cc8586a1ed
[3.13] Clarify base64.a85encode docs: *wrapcols* doesn't count the newline (GH-119409) (GH-119483)
Clarify base64.a85encode docs: *wrapcols* doesn't count the newline (GH-119409)
(cherry picked from commit ffa24aab10)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-05-28 16:55:37 +02:00