Commit Graph

31751 Commits

Author SHA1 Message Date
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) dcf585d0c1
[3.13] Re-order imports to align with zipp 3.18.2 (GH-119587) (#119589)
Re-order imports to align with zipp 3.18.2 (GH-119587)
(cherry picked from commit 5482a939ac)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-05-28 08:49:13 -04:00
Miss Islington (bot) 3b111a38ea
[3.13] gh-116860: Remove outdated `test_parserhack` from `test_future` (GH-116861) (#119649)
gh-116860: Remove outdated `test_parserhack` from `test_future` (GH-116861)
(cherry picked from commit 669175bf8e)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-28 09:55:37 +00:00
Eric Snow 9216a5336f
[3.13] gh-117398: Revert gh-119636, Add multiphase support to _datetime (#119639)
Revert "[3.13] gh-117398: Add multiphase support to _datetime (gh-119373) (gh-119636)"

This reverts commit d58ebf073c.
2024-05-28 00:52:52 +00:00
Miss Islington (bot) d58ebf073c
[3.13] gh-117398: Add multiphase support to _datetime (gh-119373) (gh-119636)
This is minimal support.  Subinterpreters are not supported yet.  That will be addressed in a later change.

(cherry picked from commit 3e8b60905e)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-05-27 16:36:32 -06:00
Miss Islington (bot) 660125f864
[3.13] gh-119584: Fix test_import Failed Assertion (gh-119623) (gh-119633)
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().

(cherry picked from commit ae7b17673f)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-05-27 20:04:13 +00:00
Miss Islington (bot) bd9983cab8
[3.13] gh-119560: Drop an Invalid Assert in PyState_FindModule() (gh-119561) (gh-119632)
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.

(cherry picked from commit 0c5ebe13e9)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-05-27 19:11:29 +00:00
Miss Islington (bot) cc38ee1edb
gh-118263: Add additional arguments to path_t (Argument Clinic type) in posixmodule (GH-118355)
(cherry picked from commit 96b392df30)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-05-24 18:26:06 +00:00
Miss Islington (bot) c864efba25
[3.13] gh-118692: Avoid creating unnecessary StopIteration instances for monitoring (GH-119216) (#119497)
* gh-118692: Avoid creating unnecessary StopIteration instances for monitoring (GH-119216)
(cherry picked from commit 6e9863d7a3)

---------

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-05-24 10:18:13 +00:00
Victor Stinner c750061047
[3.13] gh-119461: Fix ThreadedVSOCKSocketStreamTest (#119465) (#119479)
gh-119461: Fix ThreadedVSOCKSocketStreamTest (#119465)

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).

(cherry picked from commit e94dbe4ed8)
2024-05-23 22:27:04 +00:00
Miss Islington (bot) d98d6b1776
[3.13] gh-118727: Don't drop the GIL in `drop_gil()` unless the current thread holds it (GH-118745) (#119474)
`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.
(cherry picked from commit be1dfccdf2)

Co-authored-by: Brett Simmers <swtaarrs@users.noreply.github.com>
2024-05-23 21:27:38 +00:00
Miss Islington (bot) 8fd8cc564b
[3.13] gh-119469: Fix _pyrepl reference leaks (GH-119470) (#119471)
(cherry picked from commit 6e012ced6c)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-23 19:58:59 +02:00
Miss Islington (bot) 251ef2e36f
[3.13] GH-117195: Avoid assertion error in `object.__sizeof__` (GH-117220) (GH-119456) 2024-05-23 16:58:34 +01:00
Miss Islington (bot) 58dbb4a4b0
[3.13] gh-111201: Speed up paste mode in the REPL (#119341) (GH-119432) (#119439)
(cherry picked from commit e6572e8f98)

Also includes:

* gh-111201: Use calc_complete_screen after bracketed paste in PyREPL (GH-119432)
(cherry picked from commit 14b063cbf1)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2024-05-23 04:23:40 +00:00
Lysandros Nikolaou 9fa1b4fc46
[3.13] gh-118911: Trailing whitespace in a block shouldn't prevent the user from terminating the code block (GH-119355) (#119404)
(cherry picked from commit 5091c4400c)

Co-authored-by: Aya Elsayed <ayah.ehab11@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-23 00:12:26 -04:00
Lysandros Nikolaou 9435124d4a
[3.13] gh-111201: auto-indentation in _pyrepl (GH-119348) (#119427)
(cherry picked from commit cd516cd1f5)

Co-authored-by: Arnon Yaari <wiggin15@yahoo.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 23:14:03 +02:00
Lysandros Nikolaou e6e4efcc86
[3.13] gh-119357: Increase test coverage for keymap in _pyrepl (GH-119358) (#119414)
(cherry picked from commit 73ab83b27f)

Co-authored-by: Eugene Triguba <eugenetriguba@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 23:13:01 +02:00
Miss Islington (bot) 08416065a7
[3.13] gh-119247: Add macros to use PySequence_Fast safely in free-threaded build (GH-119315) (#119419)
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.
(cherry picked from commit baf347d916)

Co-authored-by: Josh {*()} Rosenberg <26495692+MojoVampire@users.noreply.github.com>
2024-05-22 19:24:02 +00:00
Miss Islington (bot) bfd9c3ea53
[3.13] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331) (gh-119410)
_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.

(cherry picked from commit 81865002ae)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-05-22 12:09:48 -06:00
Miss Islington (bot) a463cd8e45
[3.13] gh-118893: Evaluate all statements in the new REPL separately (GH-119318) (#119408)
(cherry picked from commit a3e4fec873)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 16:22:01 +00:00
Miss Islington (bot) eafd633fac
[3.13] gh-119205: Fix autocompletion bug in new repl (GH-119229) (#119407)
(cherry picked from commit 506b1a3ff6)

Co-authored-by: Koudai Aono <koxudaxi@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 16:07:38 +00:00
Lysandros Nikolaou ac9163637b
[3.13] gh-111201: Remove readline dependency from the PyREPL (GH-119262) (#119403)
(cherry picked from commit 561ff1fa71)
2024-05-22 11:45:11 -04:00
Lysandros Nikolaou 721459831a
[3.13] gh-119306: Break up _pyrepl tests (GH-119307) (#119362)
(cherry picked from commit f49df4f486)

Co-authored-by: Eugene Triguba <eugenetriguba@gmail.com>
2024-05-22 11:02:18 -04:00
Miss Islington (bot) 6892b400dc
[3.13] gh-118643: Fix AttributeError in the email module (GH-119099) (GH-119389)
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.
(cherry picked from commit 858b9e85fc)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-22 14:07:38 +03:00
Miss Islington (bot) ec484b6862
[3.13] gh-119189: Add yet more tests for mixed Fraction arithmetic (GH-119298) (GH-119346)
(cherry picked from commit 10b1bd926a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-22 09:37:07 +00:00
Miss Islington (bot) e992217810
[3.13] gh-118877: Fix AssertionError crash in pyrepl (GH-118936) (#119363)
(cherry picked from commit c0d81b2566)

Co-authored-by: Daniel Hollas <daniel.hollas@bristol.ac.uk>
2024-05-22 01:28:24 +00:00
Miss Islington (bot) f15fbe9991
gh-118507 : Refactor `nt._path_is*` to improve applicability for other cases (GH-118755)
(cherry picked from commit b64182550f)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-05-22 00:29:34 +00:00
Miss Islington (bot) 42a8d11752
[3.13] gh-119050: Add XML support to libregrtest refleak checker (GH-119148) (#119270)
gh-119050: Add XML support to libregrtest refleak checker (GH-119148)

regrtest test runner: Add XML support to the refleak checker
(-R option).

* run_unittest() now stores XML elements as string, rather than
  objects, in support.junit_xml_list.
* runtest_refleak() now saves/restores XML strings before/after
  checking for reference leaks. Save XML into a temporary file.
(cherry picked from commit 9257731f5d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-05-20 22:50:20 +00:00
Miss Islington (bot) 572b0b0809
[3.13] gh-119189: Add more tests for mixed Fraction arithmetic (GH-119236) (GH-119255)
(cherry picked from commit fe67af1963)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-20 21:00:20 +00:00
Miss Islington (bot) 054f1af811
[3.13] gh-92081: Fix for email.generator.Generator with whitespace between encoded words. (GH-92281) (#119245)
* Fix for email.generator.Generator with whitespace between encoded words.

email.generator.Generator currently does not handle whitespace between
encoded words correctly when the encoded words span multiple lines.  The
current generator will create an encoded word for each line.  If the end
of the line happens to correspond with the end real word in the
plaintext, the generator will place an unencoded space at the start of
the subsequent lines to represent the whitespace between the plaintext
words.

A compliant decoder will strip all the whitespace from between two
encoded words which leads to missing spaces in the round-tripped
output.

The fix for this is to make sure that whitespace between two encoded
words ends up inside of one or the other of the encoded words.  This
fix places the space inside of the second encoded word.

A second problem happens with continuation lines.  A continuation line that
starts with whitespace and is followed by a non-encoded word is fine because
the newline between such continuation lines is defined as condensing to
a single space character.  When the continuation line starts with whitespace
followed by an encoded word, however, the RFCs specify that the word is run
together with the encoded word on the previous line.  This is because normal
words are filded on syntactic breaks by encoded words are not.

The solution to this is to add the whitespace to the start of the encoded word
on the continuation line.

Test cases are from GH-92081

* Rename a variable so it's not confused with the final variable.
(cherry picked from commit a6fdb31b67)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2024-05-20 20:01:56 +00:00
Miss Islington (bot) 3a8ab99bf7
[3.13] gh-119121: Fix and test `async.staggered.staggered_race` (GH-119173) (#119206)
gh-119121: Fix and test `async.staggered.staggered_race` (GH-119173)
(cherry picked from commit 16b46ebd2b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-20 11:31:31 +00:00
Miss Islington (bot) 27b61c17a1
[3.13] GH-119113: Raise `TypeError` from `pathlib.PurePath.with_suffix(None)` (GH-119124) (#119183)
Restore behaviour from 3.12 when `path.with_suffix(None)` is called.
(cherry picked from commit 3c28510b98)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-05-19 16:27:12 +00:00
Miss Islington (bot) fdc50bac16
[3.13] GH-118447: Fix FreeBSD test failures. (GH-119170) (#119181)
GH-118447: Fix FreeBSD test failures. (GH-119170)

Apparently only macOS requires read permission to call `readlink()` on a
symlink.
(cherry picked from commit 4b76671728)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-05-19 16:22:51 +00:00
Miss Islington (bot) 7407267ce4
[3.13] GH-118447: Fix handling of unreadable symlinks in `os.path.realpath()` (GH-118489) (#119163)
(cherry picked from commit caf6064a1b)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-05-18 23:12:19 +00:00
Miss Islington (bot) 91296146d5
[3.13] gh-119050: Add type hints to libregrtest/results.py (GH-119144) (#119156)
gh-119050: Add type hints to libregrtest/results.py (GH-119144)

Sort also 'omitted' in TestResults.display_result().
(cherry picked from commit 30b4e9f9c4)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-05-18 21:05:58 +00:00
Miss Islington (bot) 9c2de86b5b
[3.13] gh-119132: Log sys._is_gil_enabled() in test.pythoninfo (GH-119140) (#119143)
gh-119132: Log sys._is_gil_enabled() in test.pythoninfo (GH-119140)
(cherry picked from commit 74072a3ffc)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-05-18 13:46:21 +00:00
Miss Islington (bot) ced71d39cf
[3.13] gh-119049: Fix incorrect display of warning which is constructed by C API (GH-119063) (GH-119106)
The source line was not displayed if the warnings module had not yet
been imported.
(cherry picked from commit 100c7ab00a)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-05-17 18:16:58 +03:00
Miss Islington (bot) 8a4730e95e
[3.13] Add Tkinter tests for different events (GH-118778) (GH-119091)
(cherry picked from commit b6839942a8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-16 13:17:19 +03:00
Miss Islington (bot) 1dc7fcd803
[3.13] gh-119064: Use os_helper.FakePath instead of pathlib.Path in tests (GH-119065) (GH-119087)
(cherry picked from commit 0152dc4ff5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-16 10:51:18 +03:00
Miss Islington (bot) e1dfa978b1
gh-118486: Simplify test_win32_mkdir_700 to check the exact ACL (GH-119056)
(cherry picked from commit 94591dca51)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-05-15 11:21:27 +00:00
Miss Islington (bot) 041cc2a4be
[3.13] typing tests: remove some unnecessary uses of `exec()` (GH-119005) (#119038)
(cherry picked from commit a9328e2b6e)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-14 14:39:55 +00:00
Miss Islington (bot) 54839f0734
[3.13] Add yet few cases for urlparse/urlunparse roundtrip tests (GH-119031) (GH-119037)
(cherry picked from commit 331d385af9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-14 14:23:40 +00:00
Miss Islington (bot) 8720006062
[3.13] gh-67693: Fix urlunparse() and urlunsplit() for URIs with path starting with multiple slashes and no authority (GH-113563) (GH-119023)
(cherry picked from commit e237b25a4f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-14 09:47:05 +00:00
Miss Islington (bot) 09d4c072eb
[3.13] gh-58933: Make pdb return to caller frame correctly when f_trace is not set (GH-118979) (#119007)
gh-58933: Make pdb return to caller frame correctly when f_trace is not set (GH-118979)
(cherry picked from commit f526314194)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-05-13 20:18:03 +01:00
Miss Islington (bot) a8ea9669aa
[3.13] gh-87106: Fix inspect.signature.bind() handling of positional-only arguments with **kwargs (GH-103404) (#118985)
(cherry picked from commit 9c15202441)

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2024-05-13 08:35:31 +00:00
Miss Islington (bot) 6e855b30a9
[3.13] gh-118899: Add tests for `NotImplemented` attribute access (GH-118902) (#118968)
gh-118899: Add tests for `NotImplemented` attribute access (GH-118902)
(cherry picked from commit ec1398e117)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-12 14:23:45 +00:00
Miss Islington (bot) d3094744d4
[3.13] gh-117655: Prevent `test_strptime` from raising a DeprecationWarning (GH-117668) (GH-118956)
gh-117655: Prevent `test_strptime` from raising a DeprecationWarning (GH-117668)

* Fix `test_strptime` raises a DeprecationWarning
* Ignore deprecation warnings where appropriate.
* Update Lib/test/datetimetester.py

This is follow on work to silence unnecessary warnings from the test suite that changes for https://github.com/python/cpython/issues/70647 added.
(cherry picked from commit abead548af)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-05-11 22:18:23 +00:00
Miss Islington (bot) 93ef7aa03c
[3.13] gh-118921: Add `copy()` method for `FrameLocalsProxy` (GH-118923) (#118933)
(cherry picked from commit 35c436186b)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-05-10 23:15:54 +00:00