Commit graph

51015 commits

Author SHA1 Message Date
Miss Islington (bot)
eb4774d2b7
[3.12] gh-100762: Fix optimization in gen_close (GH-111069) (#115818)
gh-100762: Fix optimization in gen_close  (GH-111069)
(cherry picked from commit 0db2517687)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-02-22 14:05:59 +00:00
Frank Hoffmann
d2fced7128
[3.12] gh-112364: Correct unparsing of backslashes and quotes in ast.… (#115782)
[3.12] gh-112364: Correct unparsing of backslashes and quotes in ast.unparse (GH-115696)
(cherry picked from commit 69ab93082d)
2024-02-21 23:28:07 +00:00
Miss Islington (bot)
3651c2729a
[3.12] gh-93205: When rotating logs with no namer specified, match whole extension (GH-93224) (GH-115784)
(cherry picked from commit 113687a838)

Co-authored-by: Gabriele Catania <gabriele.ctn@gmail.com>
2024-02-21 21:36:25 +00:00
Miss Islington (bot)
dae7341da2
[3.12] gh-96310: Fix a traceback in argparse when all options in a mutually exclusive group are suppressed (GH-96311) (GH-115767)
Reproducer depends on terminal size - the traceback occurs when there's
an option long enough so the usage line doesn't fit the terminal width.
Option order is also important for reproducibility.

Excluding empty groups (with all options suppressed) from inserts
fixes the problem.
(cherry picked from commit 5f7df88821)

Co-authored-by: Daniel Mach <daniel.mach@suse.com>
2024-02-21 18:20:29 +02:00
Miss Islington (bot)
f1c1afd45b
[3.12] gh-86291: linecache: get module name from __spec__ if available (GH-22908) (GH-115731)
This allows getting source code for the __main__ module when a custom
loader is used.
(cherry picked from commit e976baba99)

Co-authored-by: Eugene Toder <eltoder@users.noreply.github.com>
2024-02-20 18:14:24 +00:00
Serhiy Storchaka
5ea86f496a
[3.12] gh-115712: Support CSV dialects with delimiter=' ' and skipinitialspace=True (GH-115721) (GH-115729)
csv.writer() now quotes empty fields if delimiter is a space and
skipinitialspace is true and raises exception if quoting is not possible.
(cherry picked from commit 937d282150)
2024-02-20 17:53:29 +00:00
Miss Islington (bot)
20907ca844
[3.12] Add missed stream argument (GH-111775) (#115716)
Add missed `stream` argument (GH-111775)

* Add missed `stream` argument

* Add news
(cherry picked from commit 1ff6c1416b)

Co-authored-by: Alexander Shadchin <shadchin@yandex-team.com>
2024-02-20 11:36:55 -05:00
Miss Islington (bot)
e4fd5d542a
[3.12] gh-115539: Allow enum.Flag to have None members (GH-115636) (GH-115694)
gh-115539: Allow enum.Flag to have None members (GH-115636)
(cherry picked from commit c2cb31bbe1)

Co-authored-by: Jason Zhang <yurenzhang2017@gmail.com>
2024-02-19 16:18:40 -08:00
Miss Islington (bot)
cffb4c78d3
[3.12] gh-60346: Improve handling single-dash options in ArgumentParser.parse_known_args() (GH-114180) (GH-115675)
(cherry picked from commit e47ecbd042)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-19 18:25:09 +00:00
Miss Islington (bot)
a08be89212
[3.12] gh-115341: Fix loading unit tests with doctests in -OO mode (GH-115342) (GH-115671)
(cherry picked from commit 872cc9957a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-19 17:49:08 +00:00
Miss Islington (bot)
1d2f92a9b7
[3.12] Fix test_py_compile with -O mode (GH-115345) (GH-115669)
(cherry picked from commit 07ef9d86a5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-19 17:30:22 +00:00
Miss Islington (bot)
3fd72d99ab
[3.12] Fix test_compile with -O mode (GH-115346) (GH-115668)
(cherry picked from commit 7b25a82e83)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-19 17:17:53 +00:00
Miss Islington (bot)
323f63574b
[3.12] gh-115154: Fix untokenize handling of unicode named literals (GH-115171) (#115662)
gh-115154: Fix untokenize handling of unicode named literals (GH-115171)
(cherry picked from commit ecf16ee50e)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-02-19 16:38:43 +00:00
Miss Islington (bot)
e25ac3ba1d
[3.12] gh-111358: Fix timeout behaviour in BaseEventLoop.shutdown_default_executor (GH-115622) (#115641)
(cherry picked from commit 53d5e67804)

Co-authored-by: Jamie Phan <jamie@ordinarylab.dev>
2024-02-19 00:17:40 +00:00
Miss Islington (bot)
dd961d8329
[3.12] gh-108303: Move Lib/test/sortperf.py to Tools/scripts (GH-114687) (#115625)
gh-108303: Move `Lib/test/sortperf.py` to `Tools/scripts` (GH-114687)
(cherry picked from commit f9154f8f23)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-02-18 07:46:23 +00:00
Serhiy Storchaka
b9d1efa696
[3.12] gh-115618: Remove improper Py_XDECREFs in property methods (GH-115619) (GH-115620)
(cherry picked from commit 090dd21ab9)
2024-02-17 21:43:59 +00:00
Miss Islington (bot)
dadc7681ab
[3.12] gh-115596: Fix ProgramPriorityTests in test_os permanently changing the process priority (GH-115610) (GH-115616)
(cherry picked from commit 90dd653a61)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2024-02-17 19:14:26 +02:00
Miss Islington (bot)
9563e46a78
[3.12] Fix ProgramPriorityTests on FreeBSD with high nice value (GH-100145) (GH-115614)
It expects priority to be capped with 19, which is the cap for Linux,
but for FreeBSD the cap is 20 and the test fails under the similar
conditions. Tweak the condition to cover FreeBSD as well.
(cherry picked from commit 437924465d)

Co-authored-by: Dmitry Marakasov <amdmi3@amdmi3.ru>
2024-02-17 15:35:34 +00:00
Kirill Podoprigora
e32cde54f5
[3.12] gh-107155: Fix help() for lambda function with return annotation (GH-115612)
(cherry picked from commit b9a9e3dd62)
2024-02-17 17:14:41 +02:00
Miss Islington (bot)
6e89292f2c
[3.12] gh-115567: Catch test_ctypes.test_callbacks.test_i38748_stackCorruption stdout output (GH-115568) (GH-115609)
(cherry picked from commit 265548a4ea)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-02-17 14:41:46 +00:00
Miss Islington (bot)
3991db062e
[3.12] gh-101384: Add socket timeout to ThreadedVSOCKSocketStreamTest and skip it on WSL (GH-101419) (GH-115585)
(cherry picked from commit 9fd420f53d)

Co-authored-by: Peter Jiping Xie <peter.jp.xie@gmail.com>
2024-02-17 15:03:04 +02:00
Miss Islington (bot)
23aef575c7
[3.12] gh-100985: Consistently wrap IPv6 IP address during CONNECT (GH-100986) (GH-115591)
Update _get_hostport to always remove square brackets
from IPv6 addresses. Then add them if needed
in "CONNECT .." and "Host: ".
(cherry picked from commit 465db27cb9)

Co-authored-by: Derek Higgins <derekh@redhat.com>
2024-02-17 15:01:48 +02:00
Miss Islington (bot)
9148b77e0a
[3.12] gh-100884: email/_header_value_parser: don't encode list separators (GH-100885) (GH-115592)
ListSeparator should not be encoded. This could happen when a long line
pushes its separator to the next line, which would have been encoded.
(cherry picked from commit 09fab93c3d)

Co-authored-by: Thomas Weißschuh <thomas@t-8ch.de>
2024-02-17 15:00:39 +02:00
Miss Islington (bot)
de347c0207
[3.12] gh-95782: Fix io.BufferedReader.tell() etc. being able to return offsets < 0 (GH-99709) (GH-115599)
lseek() always returns 0 for character pseudo-devices like
`/dev/urandom` (for other non-regular files, e.g. `/dev/stdin`, it
always returns -1, to which CPython reacts by raising appropriate
exceptions). They are thus technically seekable despite not having seek
semantics.

When calling read() on e.g. an instance of `io.BufferedReader` that
wraps such a file, `BufferedReader` reads ahead, filling its buffer,
creating a discrepancy between the number of bytes read and the internal
`tell()` always returning 0, which previously resulted in e.g.
`BufferedReader.tell()` or `BufferedReader.seek()` being able to return
positions < 0 even though these are supposed to be always >= 0.

Invariably keep the return value non-negative by returning
max(former_return_value, 0) instead, and add some corresponding tests.
(cherry picked from commit 26800cf25a)

Co-authored-by: 6t8k <58048945+6t8k@users.noreply.github.com>
2024-02-17 14:56:00 +02:00
Miss Islington (bot)
d46a2a0008
[3.12] gh-97590: Update docs and tests for ftplib.FTP.voidcmd() (GH-96825) (GH-115601)
Since 2f3941d743 this function returns the
response string, rather than nothing.
(cherry picked from commit e88ebc1c40)

Co-authored-by: Matthew Hughes <34972397+matthewhughes934@users.noreply.github.com>
2024-02-17 14:54:50 +02:00
Miss Islington (bot)
bf0e072980
[3.12] gh-96497: Mangle name before symtable lookup in 'symtable_extend_namedexpr_scope' (GH-96561) (GH-115603)
(cherry picked from commit 664965a1c1)

Co-authored-by: wookie184 <wookie1840@gmail.com>
2024-02-17 14:49:39 +02:00
Jelle Zijlstra
83c7dd5200
[3.12] gh-115570: Fix DeprecationWarnings in test_typing (#115571) (#115574)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-16 13:46:48 -08:00
Nikita Sobolev
9bc32cdc36
[3.12] gh-108303: Move all pydoc related files to test_pydoc (GH-114506) (#115502)
(cherry picked from commit ccc76c3e88)
2024-02-15 16:35:56 +03:00
Donghee Na
5ec52c35eb
[3.12] gh-112087: Fix reduce logic for the empty reverse iterator for list (gh-115471) 2024-02-14 18:44:26 +00:00
Miss Islington (bot)
d25894332a
[3.12] gh-115243: Fix crash in deque.index() when the deque is concurrently modified (GH-115247) (GH-115465)
(cherry picked from commit 671360161f)

Co-authored-by: kcatss <kcats9731@gmail.com>
2024-02-14 17:17:58 +00:00
Miss Islington (bot)
13af281a53
[3.12] gh-115392: Fix doctest reporting incorrect line numbers for decorated functions (GH-115440) (#115459)
gh-115392: Fix doctest reporting incorrect line numbers for decorated functions (GH-115440)
(cherry picked from commit bb791c7728)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2024-02-14 15:58:14 +00:00
Miss Islington (bot)
527d9c9d7c
[3.12] gh-115450: Fix direct invocation of test_desctut (GH-115451) (#115453)
gh-115450: Fix direct invocation of `test_desctut` (GH-115451)
(cherry picked from commit ec8909a239)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-02-14 13:59:47 +00:00
Miss Islington (bot)
79d1d6de1d
[3.12] gh-115252: Fix test_enum with -OO mode again (GH-115334) (GH-115396)
(cherry picked from commit ca3604a3e3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-13 10:38:27 +00:00
Mark Shannon
4d87832d87
[3.12] GH-112215: Backport C recursion changes (GH-115083) 2024-02-13 10:45:59 +01:00
John Belmonte
09c98e4633
[3.12] gh-114563: C decimal falls back to pydecimal for unsupported format strings (GH-114879) (GH-115353)
Immediate merits:
* eliminate complex workarounds for 'z' format support
  (NOTE: mpdecimal recently added 'z' support, so this becomes
  efficient in the long term.)
* fix 'z' format memory leak
* fix 'z' format applied to 'F'
* fix missing '#' format support

Suggested and prototyped by Stefan Krah.

Fixes gh-114563, gh-91060

(cherry picked from commit 72340d15cd)

Co-authored-by: John Belmonte <john@neggie.net>
Co-authored-by: Stefan Krah <skrah@bytereef.org>
2024-02-12 23:31:12 +02:00
Miss Islington (bot)
2ed47d8f8b
[3.12] gh-115285: Fix test_dataclasses with -OO mode (GH-115286) (#115359)
gh-115285: Fix `test_dataclasses` with `-OO` mode (GH-115286)
(cherry picked from commit 4297d7301b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-02-12 20:27:48 +00:00
Serhiy Storchaka
225856ef3e
[3.12] gh-115233: Fix an example in the Logging Cookbook (GH-115325) (GH-115355)
Also add more tests for LoggerAdapter.

Also support stacklevel in LoggerAdapter._log().
(cherry picked from commit 91822018ee)
2024-02-12 18:29:48 +00:00
Serhiy Storchaka
cfb79caaab
[3.12] gh-97959: Fix rendering of routines in pydoc (GH-113941) (GH-115296)
* Class methods no longer have "method of builtins.type instance" note.
* Corresponding notes are now added for class and unbound methods.
* Method and function aliases now have references to the module or the
  class where the origin was defined if it differs from the current.
* Bound methods are now listed in the static methods section.
* Methods of builtin classes are now supported as well as methods of
  Python classes.
(cherry picked from commit 2939ad02be)
2024-02-11 13:56:34 +00:00
Serhiy Storchaka
d8346d6c06
[3.12] gh-115011: Improve support of __index__() in setters of members with unsigned integer type (GH-115029) (GH-115294)
Setters for members with an unsigned integer type now support
the same range of valid values for objects that has a __index__()
method as for int.

Previously, Py_T_UINT, Py_T_ULONG and Py_T_ULLONG did not support
objects that has a __index__() method larger than LONG_MAX.

Py_T_ULLONG did not support negative ints. Now it supports them and
emits a RuntimeWarning.
(cherry picked from commit d9d6909697)
2024-02-11 11:56:17 +00:00
Miss Islington (bot)
d65cd8bc4e
[3.12] gh-79382: Fix recursive glob() with trailing "**" (GH-115134) (GH-115290)
Trailing "**" no longer allows to match files and non-existing paths in
recursive glob().
(cherry picked from commit aeffc7f895)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-11 10:57:40 +00:00
Miss Islington (bot)
c4fa79b924
[3.12] gh-115133: Fix tests for XMLPullParser with Expat 2.6.0 (GH-115164) (GH-115288)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b343)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-11 10:34:04 +00:00
Miss Islington (bot)
6e13e50859
[3.12] gh-115274: Fix direct invocation of testmock/testpatch.py (GH-115275) (#115280)
gh-115274: Fix direct invocation of `testmock/testpatch.py` (GH-115275)
(cherry picked from commit f8e9c57067)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-02-11 12:14:37 +03:00
Miss Islington (bot)
5baf90e038
[3.12] gh-115249: Fix test_descr with -OO mode (GH-115250) (#115277)
gh-115249: Fix `test_descr` with `-OO` mode (GH-115250)
(cherry picked from commit 1f23837277)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-02-11 11:57:49 +03:00
Miss Islington (bot)
f036b357b2
[3.12] gh-115254: Fix test_property with -00 mode (GH-115255) (#115261)
gh-115254: Fix `test_property` with `-00` mode (GH-115255)
(cherry picked from commit b70a68fbd6)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-02-11 10:59:37 +03:00
Miss Islington (bot)
ada6629169
[3.12] gh-115252: Fix test_enum with -OO mode (GH-115253) (GH-115260)
(cherry picked from commit 33f56b7432)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-02-10 21:15:40 -08:00
Miss Islington (bot)
a5f49ce65e
[3.12] gh-115059: Remove debugging code in test_io (GH-115240) (GH-115244)
(cherry picked from commit 597fad07f7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-10 16:04:49 +02:00
Miss Islington (bot)
7cc205872d
[3.12] gh-114552: Update __dir__ method docs: it allows returning an iterable (GH-114662) (#115234)
gh-114552: Update `__dir__` method docs: it allows returning an iterable (GH-114662)
(cherry picked from commit e19103a346)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-02-10 08:50:31 +00:00
Miss Islington (bot)
321ec5e0fe
[3.12] gh-115165: Fix typing.Annotated for immutable types (GH-115213) (#115227)
gh-115165: Fix `typing.Annotated` for immutable types (GH-115213)

The return value from an annotated callable can raise any exception from
__setattr__ for the `__orig_class__` property.
(cherry picked from commit 564385612c)

Co-authored-by: dave-shawley <daveshawley@gmail.com>
2024-02-09 22:31:57 +00:00
Miss Islington (bot)
0211f919b1
[3.12] gh-115059: Flush the underlying write buffer in io.BufferedRandom.read1() (GH-115163) (GH-115205)
(cherry picked from commit 846fd721d5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-09 11:00:35 +00:00
Miss Islington (bot)
7d2f88edf0
[3.12] gh-114071: [Enum] update docs and code for tuples/subclasses (GH-114871) (GH-114993)
Update documentation with `__new__` and `__init__` entries.

Support use of `auto()` in tuple subclasses on member assignment lines.  Previously, auto() was only supported on the member definition line either solo or as part of a tuple:

    RED = auto()
    BLUE = auto(), 'azul'

However, since Python itself supports using tuple subclasses where tuples are expected, e.g.:

    from collections import namedtuple
    T = namedtuple('T', 'first second third')

    def test(one, two, three):
        print(one, two, three)

    test(*T(4, 5, 6))
    GH- 4 5 6

it made sense to also support tuple subclasses in enum definitions.
(cherry picked from commit ff7588b729)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2024-02-08 14:01:38 -08:00