Commit graph

32434 commits

Author SHA1 Message Date
Miss Islington (bot)
a379749217
[3.13] gh-129093: Fix f-string debug text sometimes getting cut off when expression contains ! (GH-129159) (#129163)
gh-129093: Fix f-string debug text sometimes getting cut off when expression contains `!` (GH-129159)
(cherry picked from commit 767cf70844)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-01-22 00:50:22 +00:00
Miss Islington (bot)
0ddcb61ffe
[3.13] gh-123024: Correctly prepare/restore around help and show-history commands (GH-124485) (#129155)
gh-123024: Correctly prepare/restore around help and show-history commands (GH-124485)
(cherry picked from commit 5a9afe2362)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Emily Morehouse <emily@cuttlesoft.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-01-21 22:15:57 +00:00
Miss Islington (bot)
3048dcd15a
[3.13] gh-125553: Fix backslash continuation in untokenize (GH-126010) (#129153)
gh-125553: Fix backslash continuation in `untokenize` (GH-126010)
(cherry picked from commit 7ad793e5db)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-01-21 21:04:55 +00:00
Miss Islington (bot)
0c7045378f
[3.13] gh-126332: Fix pyrepl crash for double ctrl-z in line overflow (GH-126650) (#129154)
gh-126332: Fix pyrepl crash for double ctrl-z in line overflow (GH-126650)

(cherry picked from commit d147e5e52c)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2025-01-21 21:04:41 +00:00
Hugo van Kemenade
383af395af
[3.13] gh-128595: Default to stdout isatty for colour detection instead of stderr (GH-128498) (#129057)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Fix `test__colorize` unexpected keyword argument 'file' on buildbots (#129070)
2025-01-21 18:14:24 +02:00
Miss Islington (bot)
03b2ecf41c
[3.13] GH-128131: Completely support random read access of uncompressed unencrypted files in ZipFile (GH-128143) (#129091)
GH-128131: Completely support random read access of uncompressed unencrypted files in ZipFile (GH-128143)
(cherry picked from commit dda02eb7be)

Co-authored-by: 5ec1cff <56485584+5ec1cff@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-01-20 18:28:52 +00:00
Miss Islington (bot)
a1c48a750c
[3.13] gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations (GH-129063) (#129089)
gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations (GH-129063)
(cherry picked from commit ed6934e71e)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-20 17:36:50 +00:00
Serhiy Storchaka
c6a566e47b
[3.13] gh-71339: Add additional assertion methods in test.support (GH-128707) (GH-128815)
Add a mix-in class ExtraAssertions containing the following methods:

* assertHasAttr() and assertNotHasAttr()
* assertIsSubclass() and assertNotIsSubclass()
* assertStartsWith() and assertNotStartsWith()
* assertEndsWith() and assertNotEndsWith()

(cherry picked from commit 06cad77a5b)
2025-01-20 11:19:00 +02:00
Miss Islington (bot)
2120089547
[3.13] gh-80222: Fix email address header folding with long quoted-string (GH-122753) (#129007)
gh-80222: Fix email address header folding with long quoted-string (GH-122753)

Email generators using email.policy.default could incorrectly omit the
quote ('"') characters from a quoted-string during header refolding,
leading to invalid address headers and enabling header spoofing. This
change restores the quote characters on a bare-quoted-string as the
header is refolded, and escapes backslash and quote chars in the string.
(cherry picked from commit 5aaf416858)

Co-authored-by: Mike Edmunds <medmunds@gmail.com>
2025-01-19 16:06:28 -05:00
Victor Stinner
6b47499510
[3.13] gh-128679: Fix tracemalloc.stop() race conditions (#128897)
tracemalloc_alloc(), tracemalloc_realloc(), PyTraceMalloc_Track(),
PyTraceMalloc_Untrack() and _PyTraceMalloc_TraceRef() now check
tracemalloc_config.tracing after calling TABLES_LOCK().

_PyTraceMalloc_Stop() now protects more code with TABLES_LOCK(),
especially setting tracemalloc_config.tracing to 1.

Add a test using PyTraceMalloc_Track() to test tracemalloc.stop()
race condition.

Call _PyTraceMalloc_Init() at Python startup.
2025-01-18 23:39:07 +00:00
Victor Stinner
430ccbc009
[3.13] gh-111495: Add more tests on PyEval C APIs (#122789) (#128987)
* gh-111495: Add more tests on PyEval C APIs (#122789)

* Add Lib/test/test_capi/test_eval.py
* Add Modules/_testlimitedcapi/eval.c

(cherry picked from commit bf8b374639)

* gh-111495: Fix refleaks in test_capi.test_eval tests (#122851)

(cherry picked from commit b4a316087c)
2025-01-18 14:49:55 +00:00
Miss Islington (bot)
c75894a36b
[3.13] gh-128961: Fix exhausted array iterator crash in __setstate__() (GH-128962) (#128976)
(cherry picked from commit 4dade055f4)

Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
2025-01-18 10:17:42 +00:00
Victor Stinner
34ded1a1a1
[3.13] gh-128911: Add tests on the PyImport C API (#128915) (#128960)
gh-128911: Add tests on the PyImport C API (#128915)

* Add Modules/_testlimitedcapi/import.c
* Add Lib/test/test_capi/test_import.py
* Remove _testcapi.check_pyimport_addmodule(): tests already covered
  by newly added tests.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit d95ba9fa11)
2025-01-17 22:44:51 +01:00
Miss Islington (bot)
dc77f1914d
[3.13] gh-58956: Fix a frame refleak in bdb (GH-128190) (#128947)
* gh-58956: Fix a frame refleak in bdb (GH-128190)
(cherry picked from commit 767c89ba7c)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-01-17 12:49:15 -05:00
Miss Islington (bot)
c927fd9d25
[3.13] gh-128816: Fix warnings in test_doctest (GH-128817) (GH-128870)
* Fix a deprecation warning for using importlib.resources.abc.ResourceReader.
* Fix an import warning when importing readline (if it has not yet been imported).
(cherry picked from commit 599be687ec)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2025-01-16 08:57:14 +00:00
Miss Islington (bot)
88b4b435fa
[3.13] gh-109959: Skip test_glob.test_selflink() flaky test (GH-128812) (#128821)
gh-109959: Skip test_glob.test_selflink() flaky test (GH-128812)
(cherry picked from commit 1153e66e20)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-14 10:55:33 +00:00
Peter Bierma
1ec36a62eb
[3.13] gh-128717: Stop-the-world when setting the recursion limit (GH-128741) (#128757)
[3.13] gh-128717: Stop-the-world when setting the recursion limit (GH-128741)
(cherry picked from commit f6c61bf2d7)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-14 13:33:52 +05:30
Miss Islington (bot)
f2a2809683
[3.13] gh-125997: Increase test coverage for time.sleep() (GH-128751) (#128796)
gh-125997: Increase test coverage for `time.sleep()` (GH-128751)

- Add tests for durations of invalid types.
- Add tests for `int` and `float` durations, including signed zeroes durations.
- Add tests for nonzero very small durations and durations close to the clock resolution.

---------
(cherry picked from commit b70a567575)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-13 17:23:27 +00:00
Miss Islington (bot)
b1065767b4
[3.13] gh-128562: Fix generation of the tkinter widget names (GH-128604) (GH-128791)
There were possible conflicts if the widget class name ends with a digit.
(cherry picked from commit da8825ea95)

Co-authored-by: Zhikang Yan <2951256653@qq.com>
2025-01-13 18:23:33 +02:00
Miss Islington (bot)
66d0636025
[3.13] gh-128078: Clear exception in anext before calling _PyGen_SetStopIterationValue (GH-128780) (#128785)
gh-128078: Clear exception in `anext` before calling `_PyGen_SetStopIterationValue` (GH-128780)
(cherry picked from commit 76ffaef729)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-13 13:20:49 +00:00
Hugo van Kemenade
afcf238ed4
[3.13] gh-128595: Add test class helper to force no terminal colour (GH-128687) (#128778)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2025-01-13 13:57:44 +02:00
Serhiy Storchaka
6116e1ba90
[3.13] gh-128734: Explicitly close sockets in urllib tests (GH-128735) (GH-128748)
(cherry picked from commit 5ace71713b)
2025-01-12 11:30:29 +00:00
Miss Islington (bot)
3714fd07c5
[3.13] gh-128302: Fix bugs in xml.dom.xmlbuilder (GH-128284) (#128582)
gh-128302: Fix bugs in xml.dom.xmlbuilder (GH-128284)

* Allow DOMParser.parse() to correctly handle DOMInputSource instances
  that only have a systemId attribute set.
* Fix DOMEntityResolver.resolveEntity(), which was broken by the
  Python 3.0 transition.
* Add Lib/test/test_xml_dom_xmlbuilder.py with few tests.
(cherry picked from commit 6ea04da270)

Co-authored-by: Stephen Morton <git@tungol.org>
2025-01-11 13:31:04 +02:00
Miss Islington (bot)
0d2b9abd18
[3.13] gh-127196: Fix crash in _interpreters, when shared had invalid encodings (GH-127220) (#128689)
gh-127196: Fix crash in `_interpreters`, when `shared` had invalid encodings (GH-127220)
(cherry picked from commit 087bb48aca)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-01-09 20:10:08 +00:00
Thomas Grainger
13835888e6
[3.13] gh-128552: fix refcycles in eager task creation (#128553) (#128585)
gh-128552: fix refcycles in eager task creation (#128553)

(cherry picked from commit 61b9811ac6)
2025-01-08 18:16:43 +05:30
Miss Islington (bot)
7e099c51b6
[3.13] gh-128615: Cover pickling of ParamSpecArgs and ParamSpecKwargs (GH-128616) (#128625)
gh-128615: Cover pickling of `ParamSpecArgs` and `ParamSpecKwargs` (GH-128616)
(cherry picked from commit 74a517181a)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-01-08 12:32:32 +00:00
Miss Islington (bot)
77b411bd90
[3.13] gh-128613: Increase typing.Concatenate coverage (GH-128614) (#128623)
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-01-08 12:26:01 +00:00
Miss Islington (bot)
dda55ccf1a
[3.13] gh-41872: Fix quick extraction of module docstrings from a file in pydoc (GH-127520) (GH-128620)
It now supports docstrings with single quotes, escape sequences,
raw string literals, and other Python syntax.

(cherry picked from commit 474e419792)

Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్  రెడ్డి) <thatiparthysreenivas@gmail.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-01-08 14:21:15 +02:00
Miss Islington (bot)
c0ba0bc547
[3.13] gh-128617: Fix test_typing.test_readonly_inheritance (GH-128618) (#128622)
gh-128617: Fix `test_typing.test_readonly_inheritance` (GH-128618)
(cherry picked from commit 971a52b549)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-01-08 11:43:16 +00:00
Miss Islington (bot)
32012ed3bc
[3.13] gh-109413: Add more type hints to libregrtest (GH-126352) (#126388)
gh-109413: Add more type hints to `libregrtest` (GH-126352)
(cherry picked from commit bfc1d2504c)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-01-08 09:00:46 +00:00
Miss Islington (bot)
ad3bbb6b0d
[3.13] gh-98188: Fix EmailMessage.get_payload to decode data when CTE value has extra text (GH-127547) (#128528)
gh-98188: Fix EmailMessage.get_payload to decode data when CTE value has extra text (GH-127547)

Up to this point message handling has been very strict with regards to content encoding values: mixed case was accepted, but trailing blanks or other text would cause decoding failure, even if the first token was a valid encoding.  By Postel's Rule we should go ahead and decode as long as we can recognize that first token.  We have not thought of any security or backward compatibility concerns with this fix.

This fix does introduce a new technique/pattern to the Message code: we look to see if the header has a 'cte' attribute, and if so we use that.  This effectively promotes the header API exposed by HeaderRegistry to an API that any header parser "should" support.  This seems like a reasonable thing to do.  It is not, however, a requirement, as the string value of the header is still used if there is no cte attribute.

The full fix (ignore any trailing blanks or blank-separated trailing text) applies only to the non-compat32 API.  compat32 is only fixed to the extent that it now ignores trailing spaces.  Note that the HeaderRegistry parsing still records a HeaderDefect if there is extra text.

(cherry picked from commit a62ba52f14)

Co-authored-by: RanKKI <hliu86.me@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-01-07 12:43:04 -05:00
Miss Islington (bot)
883cb23dd1
[3.13] gh-128152: Argument Clinic: ignore pre-processor directives inside C comments (GH-128464) (#128478)
(cherry picked from commit a4e773c540)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-01-04 11:09:25 +00:00
Miss Islington (bot)
b875917e21
[3.13] gh-127903: Fix a crash on debug builds when calling Objects/unicodeobject::_copy_characters (GH-127876) (#128458)
gh-127903: Fix a crash on debug builds when calling `Objects/unicodeobject::_copy_characters`` (GH-127876)
(cherry picked from commit 46cb6340d7)

Co-authored-by: Alexander Shadchin <shadchin@yandex-team.com>
2025-01-03 21:20:30 +02:00
Miss Islington (bot)
ebadfd1039
[3.13] gh-128400: Stop-the-world when manually calling faulthandler (GH-128422) (GH-128423)
(cherry picked from commit c9356feef2)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-02 19:21:16 +00:00
Kumar Aditya
fa6c48e4b3
[3.13] gh-128013: fix data race in PyUnicode_AsUTF8AndSize on free-threading (#128021) (#128417) 2025-01-02 22:10:17 +05:30
Miss Islington (bot)
24cddab4a2
[3.13] gh-128014: Fix passing default='' to the tkinter method wm_iconbitmap() (GH-128015) (GH-128418)
(cherry picked from commit 58e9f95c4a)

Co-authored-by: Zhikang Yan <2951256653@qq.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-01-02 16:14:18 +00:00
Miss Islington (bot)
08ae06fe46
[3.13] gh-88834: Unify the instance check for typing.Union and types.UnionType (GH-128363) (GH-128370)
Union now uses the instance checks against its parameters instead of
the subclass checks.
(cherry picked from commit b2ac70a62a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-12-31 18:45:03 +00:00
Miss Islington (bot)
16fde763e5
[3.13] gh-127586: multiprocessing.Pool does not properly restore blocked signals (try 2) (GH-128011) (#128298)
gh-127586: multiprocessing.Pool does not properly restore blocked signals (try 2) (GH-128011)

Correct pthread_sigmask in resource_tracker to restore old signals

Using SIG_UNBLOCK to remove blocked "ignored signals" may accidentally
cause side effects if the calling parent already had said signals
blocked to begin with and did not intend to unblock them when
creating a pool. Use SIG_SETMASK instead with the previous mask of
blocked signals to restore the original blocked set.
(cherry picked from commit aeb9b65aa2)

Co-authored-by: Stephen Hansen <stephen.paul.hansen@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-12-29 11:02:53 -08:00
Miss Islington (bot)
1781525422
[3.13] gh-127537: Add __class_getitem__ to the python implementation of functools.partial (GH-127537) (#128281)
gh-127537: Add __class_getitem__ to the python implementation of functools.partial (GH-127537)
(cherry picked from commit 401bba6b58)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
2024-12-27 01:25:56 +00:00
Ethan Furman
875e49fb63
[3.13] gh-112328: Make EnumDict usable on its own and document it (GH-123669) (GH-128142)
Co-authored-by: Petr Viktorin <pviktori@redhat.com>
2024-12-24 10:50:23 -08:00
Miss Islington (bot)
e1a0c40658
[3.13] gh-127847: Fix position in the special-cased zipfile seek (GH-127856) (#128225)
gh-127847: Fix position in the special-cased zipfile seek (GH-127856)

---------
(cherry picked from commit 7ed6c5c696)

Co-authored-by: Dima Ryazanov <dima@bucket.xxx>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-12-24 16:20:58 +00:00
Miss Islington (bot)
09d15aa9a8
[3.13] gh-128049: Fix type confusion bug with the return value of a custom ExceptionGroup split function (GH-128079) (#128139)
gh-128049: Fix type confusion bug with the return value of a custom ExceptionGroup split function (GH-128079)
(cherry picked from commit 3879ca0100)

Co-authored-by: Nico-Posada <102486290+Nico-Posada@users.noreply.github.com>
2024-12-20 20:18:44 +00:00
Miss Islington (bot)
43586a4804
[3.13] gh-128116: Skip test_socket VSOCK testStream() on PermissionError (GH-128120) (#128123)
gh-128116: Skip test_socket VSOCK testStream() on PermissionError (GH-128120)
(cherry picked from commit cbfe3023e4)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-20 13:32:58 +00:00
Miss Islington (bot)
f320f747da
[3.13] gh-128030: Avoid error from PyModule_GetFilenameObject for non-module (GH-128047) (#128114)
gh-128030: Avoid error from PyModule_GetFilenameObject for non-module (GH-128047)

I missed the extra `PyModule_Check` in GH-127660 because I was looking at
3.12 as the base implementation for import from. This meant that I
missed the `PyModuleCheck` introduced in GH-112661.
(cherry picked from commit 45e6dd63b8)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-12-20 08:46:54 +00:00
Peter Bierma
3a8bdaf698
[3.13] gh-128083: Fix macro redefinition warning in clinic. (GH-127950) (#128102)
(cherry picked from commit b5d1e4552f)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-12-19 21:29:14 +00:00
Miss Islington (bot)
2ff3e95ad5
[3.13] gh-126742: Avoid checking for library filename in test_ctypes (GH-128034) (#128056)
gh-126742: Avoid checking for library filename in test_ctypes (GH-128034)

Avoid checking for library filename in `dlerror()` error messages of test_ctypes.
(cherry picked from commit 335e24fb0a)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-18 08:49:13 +00:00
Miss Islington (bot)
fe08cdf265
[3.13] gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages (GH-126746) (GH-128023)
- Add a helper to set an error from locale-encoded `char*`
- Use the helper for gdbm & dlerror messages
(cherry picked from commit 7303f06846)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-17 11:45:29 +00:00
Miss Islington (bot)
90ae4b6f5a
[3.13] gh-127353: Allow to force color output on Windows V2 (GH-127926) (#127944)
gh-127353: Allow to force color output on Windows V2 (GH-127926)
(cherry picked from commit 0ac40acec0)

Co-authored-by: Andrey Efremov <duxus@yandex.ru>
2024-12-15 10:41:11 +02:00
Victor Stinner
2996a2bed3
[3.13] gh-127906: Backport test_cext changes from the main branch (#127923) 2024-12-13 15:04:08 +00:00
Miss Islington (bot)
78095c9052
[3.13] gh-127906: Test the limited C API in test_cppext (GH-127916) (#127919)
gh-127906: Test the limited C API in test_cppext (GH-127916)
(cherry picked from commit d05a4e6a0d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-13 14:12:07 +00:00