Commit graph

51500 commits

Author SHA1 Message Date
Brian Schubert
e5c7543f12
[3.12] gh-126139: Improve error message location for future statement with unknown feature (GH-126140) (#126160)
(cherry picked from commit 224c370a36)
2024-10-30 00:54:32 +00:00
Miss Islington (bot)
b267b6241b
[3.12] GH-125866: Improve tests for pathname2url() and url2pathname() (GH-125993) (#126145)
GH-125866: Improve tests for `pathname2url()` and `url2pathname()` (GH-125993)

Merge `URL2PathNameTests` and `PathName2URLTests` test cases (which test
only the Windows-specific implementations from `nturl2path`) into the main
`Pathname_Tests` test case for these functions.

Copy/port some test cases for `pathlib.Path.as_uri()` and `from_uri()`.
(cherry picked from commit 6742f14dfd)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-10-29 21:02:12 +00:00
Kirill Podoprigora
515a5d3498
[3.12] gh-126105: Fix crash in ast module, when ._fields is delet… (#126132)
[3.12] gh-126105: Fix crash in `ast` module, when `._fields` is deleted (GH-126115)

Previously, if the `ast.AST._fields` attribute was deleted, attempts to create a new `as`t node would crash due to the assumption that `_fields` always had a non-NULL value. Now it has been fixed by adding an extra check to ensure that `_fields` does not have a NULL value (this can happen when you manually remove `_fields` attribute).
(cherry picked from commit b2eaa75b17)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-10-29 20:20:40 +02:00
Miss Islington (bot)
bce9df97d5
[3.12] gh-125783: Add tests to prevent regressions with the combination of ctypes and metaclasses. (GH-125881) (GH-125988)
cherry picked from commit 1384409460
by Jun Komoda

Also: Add test_ctypes/_support.py from 3.13+
This partially backports be89ee5649
(https://github.com/python/cpython/pull/113727)
by AN Long


Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com>
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-10-29 14:15:09 +01:00
Miss Islington (bot)
a8472fdbcd
[3.12] Align functools.reduce() docstring with PEP-257 (GH-126045) (#126114)
Yak-shave in preparation for Argument Clinic adaption in gh-125999.

(cherry picked from commit 9b14083497)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-10-29 10:13:52 +01:00
Miss Islington (bot)
385fa83a43
[3.12] gh-126014: Ignore __pycache__-only folders in makefile tests (GH-126066) (#126110)
gh-126014: Ignore `__pycache__`-only folders in makefile tests (GH-126066)
(cherry picked from commit aeafaf4cda)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2024-10-29 08:04:50 +00:00
Miss Islington (bot)
d89283b3e7
[3.12] gh-124594: Create and reuse the same context for the entire asyncio REPL session (GH-124595) (#124849)
* gh-124594: Create and reuse the same context for the entire asyncio REPL session (GH-124595)
(cherry picked from commit 67e01a430f)

Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>


---------

Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2024-10-28 15:25:00 +01:00
Serhiy Storchaka
4c039c0723
[3.12] gh-124295: Add translation tests for argparse (GH-124803) (GH-126046) (GH-126054)
(cherry picked from commit 0922a4ae0d)
(cherry picked from commit ff044ed800)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2024-10-27 18:57:11 +00:00
Miss Islington (bot)
4fc1da1b27
[3.12] gh-125966: fix use-after-free on fut->fut_callback0 due to an evil callback's __eq__ in asyncio (GH-125967) (#126048)
gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil callback's `__eq__` in asyncio (GH-125967)
(cherry picked from commit ed5059eeb1)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-27 17:32:11 +00:00
Miss Islington (bot)
fdedb2618a
[3.12] gh-125984: fix use-after-free on fut->fut_{callback,context}0 due to an evil loop.__getattribute__ (GH-126003) (#126044)
gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due to an evil `loop.__getattribute__` (GH-126003)
(cherry picked from commit f819d4301d)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-27 15:23:07 +00:00
Miss Islington (bot)
6a8e8f48b4
[3.12] gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown (GH-118960) (#125932)
gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown (GH-118960)

(cherry picked from commit 3f24bde0b6)

Co-authored-by: Javad Shafique <javadshafique@hotmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-10-26 22:02:07 +05:30
Ethan Furman
d0b2fa4804
[3.12] gh-125259: Fix error notes removal in enum initialization (GH-125647) (GH-125953)
(cherry picked from commit 34653bba64)

Co-authored-by: Mario Šaško <mariosasko777@gmail.com>
2024-10-25 16:03:52 -07:00
Miss Islington (bot)
f6682fbe49
[3.12] gh-125969: fix OOB in future_schedule_callbacks due to an evil call_soon (GH-125970) (#125992)
gh-125969: fix OOB in `future_schedule_callbacks` due to an evil `call_soon` (GH-125970)
(cherry picked from commit c5b99f5c2c)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2024-10-25 18:38:59 +00:00
Miss Islington (bot)
42927f7f25
[3.12] GH-125789: fix fut._callbacks to always return a copy of callbacks (GH-125922) (#125977)
GH-125789: fix `fut._callbacks` to always return a copy of callbacks (GH-125922)

Fix `asyncio.Future._callbacks` to always return a copy of the internal list of callbacks to avoid mutation from user code affecting the internal state.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
(cherry picked from commit cae853e3b4)
2024-10-25 19:32:46 +05:30
Tian Gao
05b11ba059
[3.12] gh-125884: Support breakpoint on functions with annotations (G… (#125903)
* [3.12] gh-125884: Support breakpoint on functions with annotations (GH-125892)
(cherry picked from commit 8f2c0f7a03)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-10-23 22:36:40 +00:00
Miss Islington (bot)
440ed18e08
[3.12] gh-124858: fix happy eyeballs refcyles (GH-124859) (#124913)
gh-124858: fix happy eyeballs refcyles (GH-124859)
(cherry picked from commit c066bf5535)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2024-10-23 12:34:11 -07:00
Serhiy Storchaka
da3d81d3ea
[3.12] gh-125355: Rewrite parse_intermixed_args() in argparse (GH-125356) (GH-125839)
* The parser no longer changes temporarily during parsing.
* Default values are not processed twice.
* Required mutually exclusive groups containing positional arguments are
  now supported.
* The missing arguments report now includes the names of all required
  optional and positional arguments.
* Unknown options can be intermixed with positional arguments in
  parse_known_intermixed_args().

(cherry picked from commit 759a54d28f)
2024-10-22 13:23:30 +00:00
Miss Islington (bot)
e6746d9a5d
[3.12] gh-53203: Fix test_strptime on Solaris (GH-125785) (GH-125807)
Use fixed timezone.
Skip roundtrip tests on locales with 2-digit year.
(cherry picked from commit 9dde4638e4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-10-21 19:37:34 +00:00
Miss Islington (bot)
0009651d8e
[3.12] gh-124969: Make locale.nl_langinfo(locale.ALT_DIGITS) returning a string again (GH-125774) (GH-125805)
This is a follow up of GH-124974. Only Glibc needed a fix.
Now the returned value is a string consisting of semicolon-separated
symbols on all Posix platforms.
(cherry picked from commit dcc4fb2c90)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-10-21 19:24:45 +00:00
Miss Islington (bot)
2746ec4ce2
[3.12] gh-125660: Reject invalid unicode escapes for Python implementation of JSON decoder (GH-125683) (GH-125695)
(cherry picked from commit df751363e3)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-10-21 16:08:10 +03:00
Miss Islington (bot)
18196fea89
[3.12] gh-125682: Reject non-ASCII digits in the Python implementation of JSON decoder (GH-125687) (GH-125693)
(cherry picked from commit d358425e69)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-10-21 16:06:02 +03:00
Miss Islington (bot)
8cc8d7d61f
[3.12] gh-125519: Improve traceback if importlib.reload() is called with a non-module object (GH-125520) (#125769)
gh-125519: Improve traceback if `importlib.reload()` is called with a non-module object (GH-125520)
(cherry picked from commit c5c21fee7a)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-10-21 08:20:42 +00:00
Miss Islington (bot)
5f6e1120e3
[3.12] gh-125522: Fix bare except in test_math.testTan (GH-125544) (#125727)
gh-125522: Fix bare except in test_math.testTan (GH-125544)
(cherry picked from commit 4b421e8aca)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-10-19 12:07:16 +00:00
Miss Islington (bot)
93933782d9
[3.12] Add tests for time.strftime() with invalid format string (GH-125696) (GH-125701)
(cherry picked from commit 2e950e3419)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-10-18 14:13:31 +00:00
Miss Islington (bot)
aa9faee686
[3.12] gh-125620: Skip check_resource_tracker_death on NetBSD due to long wait for SIGKILL process termination (GH-125621) (#125673)
gh-125620: Skip check_resource_tracker_death on NetBSD due to long wait for SIGKILL process termination (GH-125621)

* Skip test_resource_tracker_sigkill on NetBSD
(cherry picked from commit a0f5c8e627)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
2024-10-18 02:25:00 +00:00
Miss Islington (bot)
232b303e4c
[3.12] gh-52551: Fix encoding issues in strftime() (GH-125193) (GH-125657) (GH-125661)
Fix time.strftime(), the strftime() method and formatting of the
datetime classes datetime, date and time.

* Characters not encodable in the current locale are now acceptable in
  the format string.
* Surrogate pairs and sequence of surrogatescape-encoded bytes are no
  longer recombinated.
* Embedded null character no longer terminates the format string.

This fixes also gh-78662 and gh-124531.

(cherry picked from commit 08ccbb9b3f)
(cherry picked from commit ad3eac1963)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-10-17 20:04:48 +00:00
Miss Islington (bot)
5e62d9bd54
[3.12] [3.13] gh-123370: Fix the canvas not clearing after running turtledemo.clock (gh-123457) (GH-125653) (#125656)
Rewriting the day and date every tick somehow prevented them from being removed either by clicking STOP or loading another example.  The solution is to rewrite them only when they change.
(cherry picked from commit c124577ebe)

(cherry picked from commit 30d7e9e721)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Wulian <xiguawulian@gmail.com>
2024-10-17 17:09:05 +00:00
Miss Islington (bot)
dc0a176321
[3.12] gh-113570: reprlib.repr does not use builtin __repr__ for reshadowed builtins (GH-113577) (GH-125655)
(cherry picked from commit 04d6dd23e2)

Co-authored-by: George Pittock <66332098+georgepittock@users.noreply.github.com>
2024-10-17 16:59:01 +00:00
Thomas Grainger
32d457941e
[3.12] gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#124959) (#125466)
gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#124959)
2024-10-16 21:45:59 -07:00
Sam Gross
4256847190
[3.12] gh-125451: Fix deadlock in ProcessPoolExecutor shutdown (GH-125492) (#125599)
There was a deadlock when `ProcessPoolExecutor` shuts down at the same
time that a queueing thread handles an error processing a task.

Don't use `_shutdown_lock` to protect the `_ThreadWakeup` pipes -- use
an internal lock instead. This fixes the ordering deadlock where the
`ExecutorManagerThread` holds the `_shutdown_lock` and joins the
queueing thread, while the queueing thread is attempting to acquire the
`_shutdown_lock` while closing the `_ThreadWakeup`.
(cherry picked from commit 760872efec)
2024-10-16 14:03:32 -04:00
Miss Islington (bot)
cbd50a4bdc
[3.12] gh-125041: test_zlib: For s390x HW acceleration, only skip checking the compressed bytes (GH-125042) (GH-125526)
(cherry picked from commit cc5a225cdc)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-10-16 14:44:37 +02:00
Miss Islington (bot)
90b1406b88
[3.12] gh-100141: Allow pdb to deal with empty file (GH-125425) (#125537)
gh-100141: Allow pdb to deal with empty file (GH-125425)
(cherry picked from commit bb9604b62a)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-10-15 16:29:05 +00:00
Miss Islington (bot)
0a82c4cbd8
[3.12] gh-125422: Don't set the caller's f_trace if it's botframe (GH-125427) (#125531)
gh-125422: Don't set the caller's f_trace if it's botframe (GH-125427)
(cherry picked from commit 703227dd02)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-10-15 15:26:41 +00:00
Miss Islington (bot)
26725d1756
[3.12] gh-125514: fix bug in test_traceback utility. Specify exception types in except: clauses (GH-125516) (#125525)
gh-125514: fix bug in test_traceback utility. Specify exception types in except: clauses (GH-125516)
(cherry picked from commit 55c4f4c30b)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-10-15 14:28:23 +00:00
Miss Islington (bot)
86296bbc17
[3.12] Fix idlelib typos (GH-125484) (#125488)
Fix idlelib typos (GH-125484)

Propagate fixes in Doc/library/idle.rst to help.html.
Change 'interruptable' to 'interruptible' in run.py.
The latter was reported by ember91 in PR 125473.
(cherry picked from commit 3fea1d000e)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-10-14 21:34:38 +00:00
Serhiy Storchaka
9290868155
[3.12] gh-53203: Fix strptime() for %c, %x and %X formats on many locales (GH-125406) (GH-125454) (GH-125483)
Fixed most locales that use non-ASCII digits, like Persian, Burmese,
Odia and Shan.
(cherry picked from commit 5f4e5b598c)

(cherry picked from commit cbcdf34a4b)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
2024-10-14 20:59:01 +00:00
Serhiy Storchaka
21524eec48
[3.12] gh-86357: argparse: use str() consistently and explicitly to print choices (GH-117766) (GH-125432)
(cherry picked from commit 66b3922b97)

Signed-off-by: Jan Chren ~rindeal <dev.rindeal@gmail.com>
Co-authored-by: rindeal <dev.rindeal@gmail.com>
2024-10-14 07:04:44 +00:00
Barney Gale
f49221af46
[3.12] GH-125069: Fix inconsistent joining in WindowsPath(PosixPath(...)) (GH-125156) (#125410)
`PurePath.__init__()` incorrectly uses the `_raw_paths` of a given
`PurePath` object with a different flavour, even though the procedure to
join path segments can differ between flavours.

This change makes the `_raw_paths`-enabled deferred joining apply _only_
when the path flavours match.

(cherry picked from commit cb8e5995d8)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-13 18:18:41 +00:00
Miss Islington (bot)
a144037ac3
[3.12] gh-61698: Use launchctl to detect macOS window manager in tests (GH-118390) (#125393)
(cherry picked from commit ce740d4624)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-10-13 08:39:05 +00:00
Miss Islington (bot)
afddaeb769
[3.12] gh-86673: Loosen test_ttk.test_identify() requirements (GH-125335) (#125391)
In aeca373b3 (PR gh-12011, issue gh-71500), test_identify() was changed to expect different results on Darwin. Ned's fix was later adjusted by e52f9bee8. This workaround is only needed for some variants of Tk/Tcl on macOS, so we now allow both the workaround and the generic results for these tests.
(cherry picked from commit 4197a796ec)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-10-13 07:56:04 +00:00
Miss Islington (bot)
77020dae34
[3.12] Trivial change: Update comments in activate about what running hash -r does (GH-125385) (#125388)
(cherry picked from commit 82bcaf1589)
2024-10-13 08:55:37 +01:00
Miss Islington (bot)
331fc017ce
[3.12] gh-53203: Fix strptime() for %c and %x formats on many locales (GH-124946) (GH-125370)
In some locales (like French or Hebrew) the full or abbreviated names of
the default month and weekday used in __calc_date_time can be part of
other name or constant part of the %c format. The month name can also
match %m with constant suffix (like in Japanese). So the code failed to
correctly distinguish formats %a, %A, %b, %B and %m.

Cycle all month and all days of the week to find the variable part
and distinguish %a from %A and %b from %B or %m.

Fixed locales for the following languges:
Arabic, Bislama, Breton, Bodo, Kashubian, Chuvash, Estonian, French, Irish,
Ge'ez, Gurajati, Manx Gaelic, Hebrew, Hindi, Chhattisgarhi, Haitian Kreyol,
Japanese, Kannada, Korean, Marathi, Malay, Norwegian, Nynorsk, Punjabi,
Rajasthani, Tok Pisin, Yoruba, Yue Chinese, Yau/Nungon and Chinese.

(cherry picked from commit c05f9dde8a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Eli Bendersky <eliben@gmail.com>
2024-10-12 18:02:52 +00:00
Miss Islington (bot)
aa0cdeb93c
[3.12] gh-125254: Fix error report about ambiguous option in argparse (GH-125273) (GH-125360)
This was a regression introduced in gh-58573. It was only tested for the
case when the ambiguous option is the last argument in the command line.
(cherry picked from commit 63cf4e914f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-10-12 16:00:24 +03:00
Miss Islington (bot)
affffc7dda
[3.12] gh-124309: fix staggered race on eager tasks (GH-124847) (#125340)
gh-124309: fix staggered race on eager tasks (GH-124847)

This patch is entirely by Thomas and Peter

(cherry picked from commit 979c0df7c0)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-10-11 20:12:11 -07:00
Miss Islington (bot)
3f38ea11c0
[3.12] gh-116938: Clarify documentation of dict and dict.update regarding the positional argument they accept (GH-125213) (#125337)
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-10-11 23:23:54 +00:00
Jelle Zijlstra
4ab19f912d
[3.12] gh-124917: Allow keyword args to os.path.exists/lexists on Windows (GH-124918) (#125334)
(cherry picked from commit cc2938a189)
2024-10-11 15:18:46 -07:00
Serhiy Storchaka
59036318bf
[3.12] gh-125301: Backport some test support helpers (is_apple_mobile, is_apple) (GH-125311)
(cherry picked from commit 391659b3da)
2024-10-11 14:22:27 +03:00
Miss Islington (bot)
23cefd9f4c
[3.12] gh-61011: Fix inheritance of nested mutually exclusive groups in argparse (GH-125210) (GH-125309)
Previously, all nested mutually exclusive groups lost their connection
to the group containing them and were displayed as belonging directly
to the parser.

(cherry picked from commit 18c7449768)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Danica J. Sutherland <djsutherland@users.noreply.github.com>
2024-10-11 09:07:03 +00:00
Miss Islington (bot)
171ebcd4df
[3.12] [3.13] gh-124969: Fix locale.nl_langinfo(locale.ALT_DIGITS) (GH-124974) (GH-125232) (GH-125284)
(cherry picked from commit 26a93189e4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Returns a tuple of up to 100 strings for ALT_DIGITS lookup (an empty tuple on most locales).
Previously it returned the first item of that tuple or an empty string.
(cherry picked from commit 21c04e1a97)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-10-11 09:37:55 +03:00
Sergey B Kirpichev
67f8302b9c
[3.12] gh-125118: don't copy arbitrary values to _Bool in the struct module (GH-125169) (#125265)
memcopy'ing arbitrary values to _Bool variable triggers undefined
behaviour. Avoid this.
We assume that `false` is represented by all zero bytes.

Credits to Alex Gaynor.

(cherry picked from commit 87d7315ac5)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-10-10 14:56:49 +00:00