Commit graph

30756 commits

Author SHA1 Message Date
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)
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
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
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)
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
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
Raymond Hettinger
cf2532b39d
[3.12] Tee of tee was not producing n independent iterators (gh-123884) (gh-125153) 2024-10-08 20:16:18 +00:00
Miss Islington (bot)
d3b437cb78
[3.12] gh-123378: fix a crash in UnicodeError.__str__ (GH-124935) (#125098)
gh-123378: fix a crash in `UnicodeError.__str__` (GH-124935)
(cherry picked from commit ba14dfafd9)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-08 11:56:18 +00:00
Serhiy Storchaka
82257374b9
[3.12] gh-53203: Improve tests for strptime() (GH-125090) (GH-125093)
Run them with different locales and different date and time.

Add the @run_with_locales() decorator to run the test with multiple
locales.

Improve the run_with_locale() context manager/decorator -- it now
catches only expected exceptions and reports the test as skipped if no
appropriate locale is available.
(cherry picked from commit 19984fe024)
2024-10-08 09:47:37 +00:00
Miss Islington (bot)
bc237ed9a8
[3.12] gh-124653: Relax (again) detection of queue API for logging handlers (GH-124897) (GH-125060)
(cherry picked from commit 7ffe94fb24)
2024-10-08 07:24:09 +01:00
Miss Islington (bot)
db4b382b1f
[3.12] gh-125008: Fix tokenize.untokenize roundtrip for \n{{ (GH-125013) (#125021) 2024-10-06 13:34:24 +00:00
Miss Islington (bot)
c13bb996f6
[3.12] gh-121982: `csv: Add a test case for invalid quoting` constant. (GH-121983) (#124925)
gh-121982: ``csv``: Add a test case for invalid ``quoting`` constant. (GH-121983)

Test invalid quoting constant

(cherry picked from commit 656b7a3c83)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-10-03 08:31:54 +00:00
Peter Bierma
8dce4918ab
[3.12] gh-120378: Fix crash caused by integer overflow in curses (GH-124555) (#124911)
This is actually an upstream problem in curses, and has been reported
to them already:
https://lists.gnu.org/archive/html/bug-ncurses/2024-09/msg00101.html

This is a nice workaround in the meantime to prevent the segfault.

(cherry picked from commit c2ba931318)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-02 21:40:49 +00:00
Miss Islington (bot)
6660d29745
[3.12] gh-85935: Improve tests for invalid arguments in test_argparse (GH-124891) (GH-124898)
Check also specific error messages.
(cherry picked from commit 2c050d4bc2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-10-02 17:31:20 +03:00
Miss Islington (bot)
cceb25c503
[3.12] gh-122864: Fix a `test_funcattrs.test___builtins__` when executing directly (GH-124845) (#124885)
gh-122864: Fix a ``test_funcattrs.test___builtins__`` when executing directly (GH-124845)

Previously when executing ``test_functattrs.test___builtins__`` directly, it failed because the fact, that ``__builtins__`` is refers to the built-in module ``builtins`` while it's expects a ``__builtins__.__dict__``. But when this test is being run from another module, then ``__builtins__`` is refers to ``builtins.__dict__``. Now this part of the behaviour is covered.
---------

(cherry picked from commit 8fbf10d6cf)

Co-authored-by: Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-10-02 10:36:54 +00:00
Miss Islington (bot)
72bbebdfd9
[3.12] gh-58282: Fix support of tuple metavar for positional arguments in argparse (GH-124782) (GH-124881)
Previously, formatting help output or error message for positional argument
with a tuple metavar raised exception.

(cherry picked from commit 9b31a2d83f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Cyker Way <cykerway@gmail.com>
2024-10-02 12:07:38 +03:00
Miss Islington (bot)
79746b31ff
[3.12] gh-124842: Fix test.support.import_helper.make_legacy_pyc() (GH-124843) (GH-124854)
For source file "path/to/file.py" it created file with incorrect path
"/absolute/path/to/path/to/file.pyc" instead of "path/to/file.pyc".
(cherry picked from commit 60ff67d010)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-10-01 16:22:05 +00:00
Miss Islington (bot)
3b5bc8d228
[3.12] gh-124309: Revert eager task factory fix to prevent breaking downstream (GH-124810) (#124817)
gh-124309: Revert eager task factory fix to prevent breaking downstream (GH-124810)

* Revert "GH-124639: add back loop param to staggered_race (GH-124700)"

This reverts commit e0a41a5dd1.

* Revert "gh-124309: Modernize the `staggered_race` implementation to support eager task factories (GH-124390)"

This reverts commit de929f353c.
(cherry picked from commit 133e929a79)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-10-01 01:55:03 +00:00
Miss Islington (bot)
cbea45ad74
[3.12] gh-58573: Fix conflicts between abbreviated long options in the parent parser and subparsers in argparse (GH-124631) (GH-124759)
Check for ambiguous options if the option is consumed, not when it is
parsed.
(cherry picked from commit 3f27153e07)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-29 09:18:06 +00:00
Miss Islington (bot)
5464c8aa98
[3.12] gh-116850: Fix argparse for namespaces with not directly writable dict (GH-124667) (GH-124758)
It now always uses setattr() instead of setting the dict item to modify
the namespace. This allows to use a class as a namespace.
(cherry picked from commit 95e92ef6c7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-29 08:40:00 +00:00
Miss Islington (bot)
7677be5ee6
[3.12] gh-61181: Fix support of choices with string value in argparse (GH-124578) (GH-124756)
Substrings of the specified string no longer considered valid values.
(cherry picked from commit f1a2417b9e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-29 08:32:51 +00:00
Miss Islington (bot)
71a2b8d185
[3.12] gh-124345: Support abbreviated single-dash long options with = in argparse (GH-124428) (GH-124754)
(cherry picked from commit 61180446ee)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-29 08:30:26 +00:00