Commit Graph

29362 Commits

Author SHA1 Message Date
Miss Islington (bot) a27c540d20
[3.11] gh-96310: Fix a traceback in argparse when all options in a mutually exclusive group are suppressed (GH-96311) (GH-115768)
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:08 +02:00
Serhiy Storchaka 9068c8c614
[3.11] gh-115712: Support CSV dialects with delimiter=' ' and skipinitialspace=True (GH-115721) (GH-115729) (GH-115738)
(cherry picked from commit 5ea86f496a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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 19:09:10 +00:00
Miss Islington (bot) 142711a31d
[3.11] gh-86291: linecache: get module name from __spec__ if available (GH-22908) (GH-115732)
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:18:16 +00:00
Miss Islington (bot) b3384af464
[3.11] gh-115539: Allow enum.Flag to have None members (GH-115636) (GH-115695)
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:30 -08:00
Miss Islington (bot) c02b7ae4dd
[3.11] gh-60346: Improve handling single-dash options in ArgumentParser.parse_known_args() (GH-114180) (GH-115674)
(cherry picked from commit e47ecbd042)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-19 18:20:51 +00:00
Serhiy Storchaka e1994c43c0
[3.11] Fix test_compile with -O mode (GH-115346) (GH-115673)
(cherry picked from commit 7b25a82e83)
2024-02-19 18:06:13 +00:00
Miss Islington (bot) 55b9633316
[3.11] Fix test_py_compile with -O mode (GH-115345) (GH-115670)
(cherry picked from commit 07ef9d86a5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-19 17:45:56 +00:00
Miss Islington (bot) 91262320da
[3.11] gh-108303: Move `Lib/test/sortperf.py` to `Tools/scripts` (GH-114687) (#115626)
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:43:36 +00:00
Serhiy Storchaka 5dac9c53cd
[3.11] gh-115618: Remove improper Py_XDECREFs in property methods (GH-115619) (GH-115621)
(cherry picked from commit 090dd21ab9)
2024-02-17 21:47:32 +00:00
Miss Islington (bot) cd0a071fdd
[3.11] gh-115596: Fix ProgramPriorityTests in test_os permanently changing the process priority (GH-115610) (GH-115617)
(cherry picked from commit 90dd653a61)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2024-02-17 19:14:41 +02:00
Kirill Podoprigora ee3d8dcb00
[3.11] gh-107155: Fix help() for lambda function with return annotation (GH-115613)
(cherry picked from commit b9a9e3dd62)
2024-02-17 17:39:48 +02:00
Miss Islington (bot) a23aecc737
[3.11] Fix ProgramPriorityTests on FreeBSD with high nice value (GH-100145) (GH-115615)
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:38:38 +00:00
Serhiy Storchaka 6fbc61070f
[3.11] gh-100985: Consistently wrap IPv6 IP address during CONNECT (GH-100986) (GH-115606)
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 14:15:21 +00:00
Serhiy Storchaka 51b974b0ab
[3.11] gh-96497: Mangle name before symtable lookup in 'symtable_extend_namedexpr_scope' (GH-96561) (GH-115604)
(cherry picked from commit 664965a1c1)

Co-authored-by: wookie184 <wookie1840@gmail.com>
2024-02-17 13:13:26 +00:00
Miss Islington (bot) 4077f1445c
[3.11] gh-101384: Add socket timeout to ThreadedVSOCKSocketStreamTest and skip it on WSL (GH-101419) (GH-115586)
(cherry picked from commit 9fd420f53d)

Co-authored-by: Peter Jiping Xie <peter.jp.xie@gmail.com>
2024-02-17 15:02:47 +02:00
Miss Islington (bot) 70754d21c2
[3.11] gh-100884: email/_header_value_parser: don't encode list separators (GH-100885) (GH-115593)
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:01:02 +02:00
Miss Islington (bot) a5eaa14584
[3.11] gh-95782: Fix io.BufferedReader.tell() etc. being able to return offsets < 0 (GH-99709) (GH-115600)
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:55:43 +02:00
Miss Islington (bot) 2c39d00a56
[3.11] gh-97590: Update docs and tests for ftplib.FTP.voidcmd() (GH-96825) (GH-115602)
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:31 +02:00
Jelle Zijlstra c01a4808d3
[3.11] gh-115570: Fix DeprecationWarnings in test_typing (#115571)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-16 19:37:42 +00:00
Nikita Sobolev c3a274b0fe
[3.11] gh-108303: Move all `pydoc` related files to `test_pydoc` (GH-114506) (#115501)
(cherry picked from commit ccc76c3e88)
2024-02-15 16:36:10 +03:00
Donghee Na 1739efc57d
[3.11] gh-112087: Fix reduce logic for the empty reverse iterator for list (gh-115472) 2024-02-14 18:43:39 +00:00
Miss Islington (bot) 0e07ebdba4
[3.11] gh-115243: Fix crash in deque.index() when the deque is concurrently modified (GH-115247) (GH-115466)
(cherry picked from commit 671360161f)

Co-authored-by: kcatss <kcats9731@gmail.com>
2024-02-14 17:21:12 +00:00
Miss Islington (bot) c4e8ffb9a1
[3.11] gh-115392: Fix doctest reporting incorrect line numbers for decorated functions (GH-115440) (#115458)
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:55:48 +00:00
Miss Islington (bot) 1a8165012d
[3.11] gh-115450: Fix direct invocation of `test_desctut` (GH-115451) (#115454)
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 14:04:23 +00:00
Serhiy Storchaka 7ba2d78cbb
[3.11] gh-115252: Fix test_enum with -OO mode again (GH-115334) (GH-115397)
(cherry picked from commit ca3604a3e3)
2024-02-13 10:40:40 +00:00
John Belmonte b86fdf2222
[3.11] gh-114563: C decimal falls back to pydecimal for unsupported format strings (GH-114879) (GH-115384)
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 'GH-' format support

Suggested and prototyped by Stefan Krah.

Fixes gh-114563, gh-91060

(cherry picked from commit 72340d15cd)
(cherry picked from commit 09c98e4633)

Co-authored-by: Stefan Krah <skrah@bytereef.org>
2024-02-13 10:38:06 +02:00
Miss Islington (bot) 21edde17b3
[3.11] gh-115233: Fix an example in the Logging Cookbook (GH-115325) (GH-115355) (GH-115357)
Also add more tests for LoggerAdapter.

Also support stacklevel in LoggerAdapter._log().
(cherry picked from commit 225856ef3e)
(cherry picked from commit 91822018ee)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-12 23:25:47 +02:00
Miss Islington (bot) d732134232
[3.11] gh-115285: Fix `test_dataclasses` with `-OO` mode (GH-115286) (#115358)
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:21:18 +00:00
Nikita Sobolev 879d8c4660
[3.11] gh-115252: Fix `test_enum` with `-OO` mode (GH-115253) (#115279)
(cherry picked from commit 33f56b7432)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-02-11 18:19:59 +03:00
Serhiy Storchaka b9e90031a3
[3.11] [3.12] gh-97959: Fix rendering of routines in pydoc (GH-113941) (GH-115296) (GH-115302)
* 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)
(cherry picked from commit cfb79caaab)
2024-02-11 15:19:43 +00:00
Miss Islington (bot) 83a69a6a01
[3.11] gh-113468: Remove the "_new_ suffix from class names in pydocfodder (GH-113469) (GH-115300)
(cherry picked from commit 8a3d0e4a66)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-11 14:51:32 +00:00
Serhiy Storchaka 75d92f5c4e
[3.11] gh-99430: Remove duplicated tests for old-styled classes (GH-99432) (GH-115298)
python 1 & 2 were a loong time ago.
(cherry picked from commit d329f859b9)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-02-11 14:29:23 +00:00
Serhiy Storchaka 7273a58a85
[3.11] gh-115011: Improve support of __index__() in setters of members with unsigned integer type (GH-115029) (GH-115295)
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 12:03:48 +00:00
Miss Islington (bot) e72255054b
[3.11] gh-79382: Fix recursive glob() with trailing "**" (GH-115134) (GH-115291)
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 11:04:02 +00:00
Miss Islington (bot) 3501eca89e
[3.11] gh-115133: Fix tests for XMLPullParser with Expat 2.6.0 (GH-115164) (GH-115289)
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:38:04 +00:00
Miss Islington (bot) 3aa9621c39
[3.11] gh-115249: Fix `test_descr` with `-OO` mode (GH-115250) (#115278)
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:58 +03:00
Miss Islington (bot) 7f2a19eb75
[3.11] gh-115254: Fix `test_property` with `-00` mode (GH-115255) (#115262)
(cherry picked from commit b70a68fbd6)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-02-11 10:58:51 +03:00
Miss Islington (bot) 562fe5f5d4
[3.11] gh-115059: Remove debugging code in test_io (GH-115240) (GH-115245)
(cherry picked from commit 597fad07f7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-10 16:04:32 +02:00
Miss Islington (bot) 089cae5158
[3.11] gh-114552: Update `__dir__` method docs: it allows returning an iterable (GH-114662) (#115235)
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:54:43 +00:00
Miss Islington (bot) 7542210a95
[3.11] gh-115165: Fix `typing.Annotated` for immutable types (GH-115213) (#115228)
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:43:24 +00:00
Miss Islington (bot) 20c6535693
[3.11] gh-115059: Flush the underlying write buffer in io.BufferedRandom.read1() (GH-115163) (GH-115206)
(cherry picked from commit 846fd721d5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-09 11:01:47 +00:00
Miss Islington (bot) 3aa4418c5a
[3.11] gh-103224: Resolve paths properly in test_sysconfig (GH-103292) (GH-115101)
To pass tests when executed through a Python symlink.

(cherry picked from commit 71239d50b5)

Co-authored-by: Artem Mukhin <artem.m.mukhin@gmail.com>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2024-02-07 11:36:27 +02:00
Miss Islington (bot) a04dc43148
[3.11] GH-gh-75705: Set unixfrom envelope in mailbox._mboxMMDF (GH-107117) (GH-115099)
(cherry picked from commit 76108b8b05)

Co-authored-by: Matthieu Caneill <matthieucan@users.noreply.github.com>
2024-02-06 19:16:54 +00:00
Peter Lazorchak a11312456d
[3.11] gh-89811: Check for valid tp_version_tag in specializer (GH-115045)
* gh-89811: Check for valid tp_version_tag in specializer (GH-113558)

* gh-113937 Fix failures in type cache tests due to re-running (GH-113953)

* Update backported code for 3.11 specifically
2024-02-06 21:58:30 +08:00
Erlend E. Aasland ead9e784fb
[3.11] gh-115015: Argument Clinic: fix generated code for METH_METHOD methods without params (#115016) (#115069)
(cherry picked from commit 09096a1647)
2024-02-06 11:21:00 +01:00
Serhiy Storchaka e1976399cd
[3.11] gh-109475: Fix support of explicit option value "--" in argparse (GH-114814) (GH-115037)
For example "--option=--".
(cherry picked from commit 4aa4f0906d)
2024-02-05 21:04:11 +00:00
Serhiy Storchaka 89878141ed
[3.11] gh-114392: Improve test_capi.test_structmembers (GH-114393) (GH-115030)
Test all integer member types with extreme values and values outside of
the valid range. Test support of integer-like objects. Test warnings for
wrapped out values.
(cherry picked from commit 15f6f048a6)
2024-02-05 13:24:23 +02:00
Travis Howse 5ce076fd92
[3.11] gh-114887 Reject only sockets of type SOCK_STREAM in create_da… (#114979)
Also improve exception message.

(cherry picked from commit 94ec2b9c9c)

Co-authored-by: Donghee Na <donghee.na92@gmail.com>
2024-02-04 20:01:37 -08:00
Alex Waygood 510eb4e6a8
[3.11] Bump ruff to 0.2.0 (#114932) (#115008) 2024-02-04 20:00:05 +00:00
Serhiy Storchaka 0244e96d10
[3.11] gh-114388: Fix warnings when assign an unsigned integer member (GH-114391) (GH-115002)
* Fix a RuntimeWarning emitted when assign an integer-like value that
  is not an instance of int to an attribute that corresponds to a C
  struct member of type T_UINT and T_ULONG.
* Fix a double RuntimeWarning emitted when assign a negative integer value
  to an attribute that corresponds to a C struct member of type T_UINT.
(cherry picked from commit 3ddc515255)
2024-02-04 17:54:26 +00:00