Commit Graph

28991 Commits

Author SHA1 Message Date
Miss Islington (bot) 065e2ae99a
[3.11] gh-104265 Disallow instantiation of `_csv.Reader` and `_csv.Writer` (GH-104266) (#104278)
gh-104265 Disallow instantiation of `_csv.Reader` and `_csv.Writer` (GH-104266)
(cherry picked from commit 06c2a4858b)

Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
2023-05-08 17:34:43 +05:30
Erlend E. Aasland 681d5028bd
[3.11] gh-100370: fix OverflowError in sqlite3.Connection.blobopen for 32-bit builds (#103902) (#104285) 2023-05-08 08:41:34 +00:00
Tian Gao 19abf691fe
[3.11] gh-103225: Fixed zero lineno issue for pdb (#103265) (#104262)
gh-103225: Fixed zero lineno issue for pdb (#103265)

Co-authored-by: Artem Mukhin <ortem00@gmail.com>
2023-05-07 12:21:57 +01:00
Lysandros Nikolaou a09d3901a5
[3.11] gh-96670: Raise SyntaxError when parsing NULL bytes (GH-97594) (#104195) 2023-05-07 11:12:04 +01:00
Miss Islington (bot) c5dafeaa6d
[3.11] Re-enable commented-out test in test_generators.py (GH-104130) (#104261)
Re-enable commented-out test in test_generators.py (GH-104130)
(cherry picked from commit 472938316a)

Co-authored-by: ymki4360 <132453923+ymki4360@users.noreply.github.com>
2023-05-07 05:11:00 +00:00
Miss Islington (bot) cf1c25fd6e
[3.11] gh-101640: Make argparse _print_message catch any write error (GH-101802) (#104250)
gh-101640: Make argparse _print_message catch any write error (GH-101802)

* In particular, don't exit when trying to print to stderr = None.
* Add tests

(cherry picked from commit 42f54d1f92)

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-05-06 23:17:27 +00:00
Miss Islington (bot) 4536b2ec18
[3.11] gh-104049: do not expose on-disk location from SimpleHTTPRequestHandler (GH-104067) (#104123)
gh-104049: do not expose on-disk location from SimpleHTTPRequestHandler (GH-104067)

Do not expose the local server's on-disk location from `SimpleHTTPRequestHandler` when generating a directory index. (unnecessary information disclosure)

---------

(cherry picked from commit c7c3a60c88)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-03 04:27:04 +00:00
Irit Katriel 5386730cdd
[3.11] gh-103590: do not wrap a single exception raised from a try-except* (#104094) 2023-05-02 19:24:02 +01:00
Miss Islington (bot) 0d40264325
[3.11] GH-103472: close response in HTTPConnection._tunnel (GH-103473) (#104077)
GH-103472: close response in HTTPConnection._tunnel (GH-103473)

Avoid a potential `ResourceWarning` in `http.client.HTTPConnection`
by closing the proxy / tunnel's CONNECT response explicitly.

---------

(cherry picked from commit 9de0cf20fa)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-05-01 23:48:07 -07:00
Miss Islington (bot) 10db28bfcf
[3.11] gh-104018: disallow "z" format specifier in %-format of byte strings (GH-104033) (#104058)
gh-104018: disallow "z" format specifier in %-format of byte strings (GH-104033)

PEP-0682 specified that %-formatting would not support the "z" specifier,
but it was unintentionally allowed for bytes. This PR makes use of the "z"
flag an error for %-formatting in a bytestring.

Issue: GH-104018

---------

(cherry picked from commit 3ed8c88290)

Co-authored-by: John Belmonte <john@neggie.net>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-05-01 20:18:29 +00:00
Miss Islington (bot) 0df7c3a466
[3.11] gh-104035: Do not ignore user-defined `__{get,set}state__` in slotted frozen dataclasses (GH-104041) (#104044)
gh-104035: Do not ignore user-defined `__{get,set}state__` in slotted frozen dataclasses (GH-104041)
(cherry picked from commit 99aab61062)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-05-01 10:02:41 -06:00
Miss Islington (bot) 1be8bed236
[3.11] gh-104036: Fix direct invocation of test_typing (GH-104037) (#104039)
gh-104036: Fix direct invocation of test_typing (GH-104037)

Previously, `python -m test test_typing` worked, but `python Lib/test/test_typing.py` did not.
(cherry picked from commit 4181d078fc)

Co-authored-by: Kirill Podoprigora <80244920+Eclips4@users.noreply.github.com>
2023-05-01 14:17:12 +00:00
Miss Islington (bot) 2be3656855
[3.11] Improve int test coverage (GH-104024) (#104026)
Improve int test coverage (GH-104024)

Following discussion in https://discuss.python.org/t/bug-in-int-42/26360/5

This tests some of the things documented in https://github.com/python/cpython/pull/100436

(cherry picked from commit 69bc86cb1a)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-05-01 00:50:01 +00:00
Tian Gao fee3c91a19
[3.11] GH-103971: Fix incorrect locations for code following case blocks 2023-04-28 20:08:25 +00:00
Petr Viktorin 241f2e54a6
[3.11] gh-102950: Implement PEP 706 – Filter for tarfile.extractall (GH-102953) (GH-103832)
See [Backporting & Forward Compatibility in PEP 706](https://peps.python.org/pep-0706/#backporting-forward-compatibility).

- Backport b52ad18a76
- Backport c8c3956d90
- Remove the DeprecationWarning
- Adjust docs
- Remove new `__all__` entries
2023-04-28 17:41:09 +02:00
Nikita Sobolev 7f70f1c5cc
[3.11] gh-103880: Fix `assertRaises` usage in `test_genericalias` (GH-103916) (#103917)
(cherry picked from commit dff8e5dc8d)
2023-04-27 16:03:29 +05:30
Miss Islington (bot) 2cd1b9c2ca
[3.11] gh-103607: Fix `pause_reading` to work when called from `connection_made` in `asyncio`. (GH-17425) (#103918)
gh-103607: Fix `pause_reading` to work when called from `connection_made` in `asyncio`. (GH-17425)
(cherry picked from commit 78942ecd9b)

Co-authored-by: Itayazolay <itayazolay@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-04-27 10:29:54 +00:00
Miss Islington (bot) f11ba1c2de
[3.11] gh-103578: Fix pdb reading code with non-utf8 encoding (GH-103581) (#103867)
`pdb` should use `io.open_code` to open code to avoid encoding issue.
(cherry picked from commit 31acfd78a0)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2023-04-26 05:28:29 +00:00
Irit Katriel 93a9535d54
[3.11] gh-101517: fix line number propagation in code generated for except* (#103550) (#103816)
Manual backport of https://github.com/python/cpython/pull/103550.



<!-- gh-issue-number: gh-101517 -->
* Issue: gh-101517
<!-- /gh-issue-number -->

---------

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-04-25 18:08:54 +01:00
Miss Islington (bot) c8de883bcb
[3.11] gh-99184: Bypass instance attribute access in `repr` of `weakref.ref` (GH-99244) (#103789)
gh-99184: Bypass instance attribute access in `repr` of `weakref.ref` (GH-99244)
(cherry picked from commit 58b6be3791)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-04-24 19:58:55 +00:00
Miss Islington (bot) a8489f7f26
[3.11] Revert "Add tests for empty range equality (GH-103751)" (GH-103770) (#103781)
Revert "Add tests for empty range equality (GH-103751)" (GH-103770)

This reverts commit dca27a69a8.
Added tests are redundant with existing tests.
(cherry picked from commit ab25c7e311)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-04-24 18:54:21 +00:00
Miss Islington (bot) e0e1bee833
[3.11] gh-103746: Test `types.UnionType` and `Literal` types together (GH-103747) (#103772)
gh-103746: Test `types.UnionType` and `Literal` types together (GH-103747)
(cherry picked from commit 3d29edaf0a)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-04-24 17:22:36 +00:00
Miss Islington (bot) 25406e5a35
[3.11] Add tests for empty range equality (GH-103751) (#103760)
(cherry picked from commit dca27a69a8)

Co-authored-by: Kirill <80244920+Eclips4@users.noreply.github.com>
2023-04-24 11:09:46 -04:00
Miss Islington (bot) 7b2ac6cf3d
[3.11] gh-102310: Change error range for invalid bytes literals (GH-103663) (#103703) 2023-04-23 17:21:27 -06:00
Miss Islington (bot) 4e9635e2b1
[3.11] gh-103592: Add tests of `Literal` with `Enum` and `Union` of `Literal`s (GH-103706) (#103720)
gh-103592: Add tests of `Literal` with `Enum` and `Union` of `Literal`s (GH-103706)
(cherry picked from commit 5041c2ba6e)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-04-23 12:15:24 -06:00
Miss Islington (bot) ec29d0c091
[3.11] gh-103449: Fix a bug in dataclass docstring generation (GH-103454) (#103599) 2023-04-23 09:40:52 -06:00
Miss Islington (bot) 6e25228b2e
[3.11] gh-81403: Fix for CacheFTPHandler in urllib (GH-13951) (#103705)
* gh-81403: Fix for CacheFTPHandler in urllib (GH-13951)

bpo-37222: Fix for CacheFTPHandler in urllib

A call to FTP.ntransfercmd must be followed by FTP.voidresp to clear
the "end transfer" message. Without this, the client and server get
out of sync, which will result in an error if the FTP instance is
reused to open a second URL. This scenario occurs for even the most
basic usage of CacheFTPHandler.

Reverts the patch merged as a resolution to bpo-16270 and adds a test
case for the CacheFTPHandler in test_urllib2net.py.

(cherry picked from commit e38bebb9ee)

Co-authored-by: Dan Hemberger <846186+hemberger@users.noreply.github.com>
Co-authored-by: Senthil Kumaran <senthil@python.org>

* Added NEWS entry.

---------

Co-authored-by: Dan Hemberger <846186+hemberger@users.noreply.github.com>
Co-authored-by: Senthil Kumaran <senthil@python.org>
2023-04-23 05:20:34 -07:00
Miss Islington (bot) b2fdae9d86
[3.11] gh-103556: [inspect.Signature] disallow pos-or-kw params without default after pos-only with default (GH-103557) (#103675) 2023-04-22 09:13:02 -06:00
Miss Islington (bot) 9f3f109dd2
gh-103553: Improve `test_inspect`: add more assertions, remove unused (GH-103554)
(cherry picked from commit 4fe1c4b97e)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-04-15 14:15:45 -07:00
Miss Islington (bot) 2e0ead5f22
gh-103406: Modernize pos-only arguments usage in `test_signature` (GH-103407)
(cherry picked from commit 7569781176)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-04-14 00:30:38 -07:00
Ethan Furman 3b929a7b32
[3.11] gh-103479: [Enum] require __new__ to be considered a data type (GH-103495) (GH-103514)
a mixin must either have a __new__ method, or be a dataclass, to be interpreted as a data-type; an __init__ method is not enough (restores pre-3.11 behavior for non-dataclasses).

(cherry picked from commit a6f95941a3)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-04-13 12:04:06 -07:00
Miss Islington (bot) 804a973d8e
gh-103365: [Enum] STRICT boundary corrections (GH-103494)
STRICT boundary:

- fix bitwise operations
- make default for Flag
(cherry picked from commit 2194071540)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-04-13 08:55:53 -07:00
Miss Islington (bot) 254494c4b9
gh-99553: add tests for ExceptionGroup wrapping (GH-99615)
(cherry picked from commit 4cd1cc843a)

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
2023-04-11 00:07:25 -07:00
Miss Islington (bot) 4e284ffa2e
gh-103395: Improve `typing._GenericAlias.__dir__` coverage (GH-103396)
(cherry picked from commit a28e2ce3fb)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-04-10 04:37:40 -07:00
Miss Islington (bot) b4f3318207
gh-75729: Fix os.spawn tests not handling spaces on Windows (GH-99150)
* Quote paths in os.spawn tests on Windows so they work with spaces

* Add NEWS entry for os spawn test fix

* Fix code style to avoid double negative in os.spawn tests

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

---------

(cherry picked from commit a34c796238)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-04-08 01:03:58 -07:00
Miss Islington (bot) 70bc8c936d
[3.11] GH-88013: Fix TypeError raised by ntpath.realpath in some cases (GH-102813, GH-103343)
(cherry picked from commit 4dc339b4d6)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Barney Gale <barney.gale@gmail.com>
2023-04-07 21:38:56 +01:00
Miss Islington (bot) b8d1623f73
gh-103272: regression test for getattr exception in property (GH-103336)
(cherry picked from commit 5d7d86f2fd)

Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
2023-04-07 12:36:10 -07:00
Miss Islington (bot) 1b1f0164cb
gh-74690: Add more tests for runtime-checkable protocols (GH-103347)
(cherry picked from commit 800382a2b0)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-04-07 10:47:49 -07:00
Łukasz Langa ecb09a8496
[3.11] bpo-46523: fix tests rerun when `setUp[Class|Module]` fails (GH-30895) (GH-103342)
(cherry picked from commit 995386071f)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-04-07 19:35:16 +02:00
Miss Islington (bot) 8740fd855c
gh-103256: Fix hmac algorithm to support fallback implementation (gh-103286)
(cherry picked from commit efb0a2cf3a)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-04-06 19:27:46 -07:00
Miss Islington (bot) 123680f9aa
[3.11] GH-102700: allow built-in modules to be submodules (GH-103162) (GH-103322)
GH-102700: allow built-in modules to be submodules (GH-103162)
(cherry picked from commit 5d08c3ff7d)

Co-authored-by: Brett Cannon <brett@python.org>
2023-04-06 16:06:02 -07:00
Ethan Furman 58e330ac9c
[3.11] gh-93910: [Enum] remove member.member deprecation (GH-103236) (GH-103299)
i.e. Color.RED.BLUE is now officially supported..
(cherry picked from commit 4ec8dd10bd)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-04-05 21:29:14 -07:00
Miss Islington (bot) 5342f5e713
gh-102549: [Enum] fail enum creation when data type raises in __init__ (GH-103149)
(cherry picked from commit 2a4d8c0a9e)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-04-03 16:01:31 -07:00
Miss Islington (bot) 0854bdf15f
gh-103109: Document ignore_warnings() test support helper (GH-103110)
(cherry picked from commit 32937d6aa4)

Co-authored-by: Charlie Zhao <zhaoyu_hit@qq.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-04-02 15:42:43 -07:00
Miss Islington (bot) 766038d995
gh-103054: typing: Improve `Callable` type substitution tests (GH-103055)
(cherry picked from commit 60bdc16b45)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Eclips4 <80244920+Eclips4@users.noreply.github.com>
2023-03-28 20:28:34 -07:00
Miss Islington (bot) 5ba5ce47f6
gh-102558: [Enum] better handling of non-Enum EnumType classes (GH-103060)
(cherry picked from commit f4ed2c6ae5)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-03-27 16:49:15 -07:00
Miss Islington (bot) 13df5d3497
[3.11] GH-95494: Fix transport EOF handling in OpenSSL 3.0 (GH-95495) (#103006)
GH-25309 enabled SSL_OP_IGNORE_UNEXPECTED_EOF by default, with a comment
that it restores OpenSSL 1.1.1 behavior, but this wasn't quite right.
That option causes OpenSSL to treat transport EOF as the same as
close_notify (i.e. SSL_ERROR_ZERO_RETURN), whereas Python actually has
distinct SSLEOFError and SSLZeroReturnError exceptions. (The latter is
usually mapped to a zero return from read.) In OpenSSL 1.1.1, the ssl
module would raise them for transport EOF and close_notify,
respectively. In OpenSSL 3.0, both act like close_notify.

Fix this by, instead, just detecting SSL_R_UNEXPECTED_EOF_WHILE_READING
and mapping that to the other exception type.

There doesn't seem to have been any unit test of this error, so fill in
the missing one. This had to be done with the BIO path because it's
actually slightly tricky to simulate a transport EOF with Python's fd
based APIs. (If you instruct the server to close the socket, it gets
confused, probably because the server's SSL object is still referencing
the now dead fd?)
(cherry picked from commit 420bbb783b)

Co-authored-by: David Benjamin <davidben@google.com>
2023-03-27 16:14:01 +02:00
Miss Islington (bot) a08b65faa0
gh-102980: Add tests for pdf's display, alias and where commands (GH-102981)
(cherry picked from commit ded9a7fc19)

Co-authored-by: gaogaotiantian <gaogaotiantian@hotmail.com>
2023-03-24 14:17:20 -07:00
Miss Islington (bot) e075631f67
[3.11] gh-96931: Fix incorrect results in ssl.SSLSocket.shared_ciphers (GH-96932) (#102918)
gh-96931: Fix incorrect results in ssl.SSLSocket.shared_ciphers (GH-96932)
(cherry picked from commit af9c34f6ef)

Co-authored-by: Benjamin Fogle <benfogle@gmail.com>
2023-03-24 13:33:24 +01:00
Miss Islington (bot) 8132aefa0f
gh-102558: [Enum] fix AttributeError during member repr() (GH-102601)
(cherry picked from commit bd063756b3)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2023-03-23 13:56:38 -07:00
Miss Islington (bot) 1645a40b5e
gh-88965: typing: fix type substitution of a list of types after initial `ParamSpec` substitution (GH-102808)
Previously, this used to fail:

```py
from typing import *
T = TypeVar("T")
P = ParamSpec("P")

class X(Generic[P]):
    f: Callable[P, int]

Y = X[[int, T]]
Z = Y[str]
```

(cherry picked from commit adb0621652)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-03-23 09:54:07 -07:00
Miss Islington (bot) 6ffeeb2199
gh-102947: Improve traceback when calling `fields()` on a non-dataclass (GH-102948)
(cherry picked from commit baf4eb083c)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-03-23 07:45:59 -07:00
Miss Islington (bot) a9ece4a839
gh-102780: Fix uncancel() call in asyncio timeouts (GH-102815)
Also use `raise TimeOut from <CancelledError instance>` so that the CancelledError is set
in the `__cause__` field rather than in the `__context__` field.

(cherry picked from commit 04adf2df39)

Co-authored-by: Kristján Valur Jónsson <sweskman@gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-03-22 11:23:47 -07:00
Miss Islington (bot) b9304beda0
gh-101947: Remove size check from sqlite3 serialize test (GH-102914)
The size of the returned data is too implementation specific.
(cherry picked from commit 61405da9a5)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-03-22 06:45:28 -07:00
Nikita Sobolev 045c8a1779
[3.11] gh-102721: Improve coverage of `_collections_abc._CallableGenericAlias` (GH-102788)
This is a backport of https://github.com/python/cpython/pull/102722 without the `typing.py` changes.

Automerge-Triggered-By: GH:AlexWaygood
2023-03-17 12:48:06 -07:00
Miss Islington (bot) f967aee4fb
gh-102701: Fix overflow in dictobject.c (GH-102750)
(cherry picked from commit 65fb7c4055)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2023-03-17 07:54:18 -07:00
Miss Islington (bot) 0560fe3c10
gh-94440: Fix issue of ProcessPoolExecutor shutdown hanging (GH-94468)
Fix an issue of concurrent.futures ProcessPoolExecutor shutdown hanging.

(cherry picked from commit 2dc94634b5)

Co-authored-by: yonatanp <yonatan.perry@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-03-15 22:09:20 -07:00
Miss Islington (bot) 8aa07b9c8a
gh-101377: improving test_locale_calendar_formatweekday of calendar (GH-101378)
---------

(cherry picked from commit 5e0865f22e)

Co-authored-by: Andre Hora <andrehora@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-03-14 20:00:28 -07:00
Miss Islington (bot) 1649f3e591
Rename redundant enum tests so that they run (GH-102535)
(cherry picked from commit a028778d4c)

Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com>
2023-03-14 15:46:01 -07:00
Miss Islington (bot) b0e221cfc8
[3.11] gh-102069: Fix `__weakref__` descriptor generation for custom dataclasses (GH-102075) (#102662)
gh-102069: Fix `__weakref__` descriptor generation for custom dataclasses (GH-102075)
(cherry picked from commit d97757f793)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-03-13 16:17:46 -06:00
Miss Islington (bot) 8a99debc12
Fix broken link to MSDN (GH-102355)
(cherry picked from commit 9a8b66b58c)

Co-authored-by: 谭九鼎 <109224573@qq.com>
2023-03-13 06:42:30 -07:00
Miss Islington (bot) 78560261a2
GH-101673: Fix pdb bug where local variable changes are lost after longlist (GH-101674)
(cherry picked from commit 5d677c556f)

Co-authored-by: gaogaotiantian <gaogaotiantian@hotmail.com>
2023-03-12 16:40:56 -07:00
Irit Katriel fcafc37411
[3.11] gh-102493: backport unit test for PyErr_SetObject (#102602)
gh-102493: backport unit test for PyErr_SetObject
2023-03-11 15:01:01 +00:00
Miss Islington (bot) e467cb3a69
gh-102433: Add tests for how classes with properties interact with `isinstance()` checks on `typing.runtime_checkable` protocols (GH-102449)
(cherry picked from commit 5ffdaf748d)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-03-10 17:46:04 -08:00
Miss Islington (bot) 123119ff88
GH-102537: Handle check for PYTHONTZPATH failing in zoneinfo test (GH-102538)
It is possible but unlikely for the `python_tzpath_context` function to fail between the start of the `try` block and the point where `os.environ.get` succeeds, in which case `old_env` will be undefined. In this case, we want to take no action.

Practically speaking this will really only happen in an error condition anyway, so it doesn't really matter, but we should probably do it right anyway.
(cherry picked from commit 64bde502cf)

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2023-03-10 07:54:45 -08:00
Miss Islington (bot) 7905ae7b1a
GH-102397: Fix segfault from race condition in signal handling (GH-102399)
(cherry picked from commit 1a84cc007e)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-03-08 00:26:20 -08:00
Miss Islington (bot) a7ec32e7d4
gh-102444: Fix minor bugs in `test_typing` highlighted by pyflakes (GH-102445)
(cherry picked from commit 96e1022929)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-03-05 14:00:56 -08:00
Miss Islington (bot) db8d10beb3
GH-102341: Improve the test function for pow (GH-102342)
(cherry picked from commit 32220543e2)

Co-authored-by: Partha P. Mukherjee <ppm.floss@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-03-05 09:55:18 -08:00
Miss Islington (bot) c957128b48
Fix unused classes in a typing test (GH-102437)
As part of investigation issue https://github.com/python/cpython/issues/102433, I discovered what I believe to be an error where two classes `CI` and `DI` are not being used. The assertions beneath them act on `C` and `D`, duplicating existing assertions in this test.
(cherry picked from commit 7894bbe94b)

Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com>
Automerge-Triggered-By: GH:AlexWaygood
2023-03-05 07:31:42 -08:00
Miss Islington (bot) e748f9e270
gh-101979: argparse: fix a bug where parentheses in metavar argument of add_argument() were dropped (GH-102318)
(cherry picked from commit 9a478be1a4)

Co-authored-by: Yeojin Kim <yeojin.dev@gmail.com>
2023-03-05 07:18:34 -08:00
Miss Islington (bot) 63fd954100
gh-102356: Add thrashcan macros to filter object dealloc (GH-102426)
Add thrashcan macros to the deallocator of the filter objects to protect against deeply nested destruction of chains of nested filters.
(cherry picked from commit 66aa78cbe6)

Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
2023-03-05 03:25:48 -08:00
Miss Islington (bot) cc6ce90206
gh-102179: Fix `os.dup2` error reporting for negative fds (GH-102180)
(cherry picked from commit c2bd55d26f)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
2023-03-04 06:55:02 -08:00
Miss Islington (bot) 06a3bb8c94
gh-101892: Fix `SystemError` when a callable iterator call exhausts the iterator (GH-101896)
(cherry picked from commit 705487c655)

Co-authored-by: Raj <51259329+workingpayload@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-03-04 06:46:17 -08:00
Miss Islington (bot) 3effccee48
[3.11] gh-102088 Optimize iter_index itertools recipe (GH-102360) (GH-102363) 2023-03-01 21:52:37 -06:00
Miss Islington (bot) 3fe74199fd
gh-102252: Improve coverage of test_bool.py (GH-102253)
Add tests for conversion from bool to complex.
(cherry picked from commit 4197043637)

Co-authored-by: Eclips4 <80244920+Eclips4@users.noreply.github.com>
2023-02-25 13:15:45 -08:00
Ionite 5d461225a5
[3.11] gh-101765: Fix SystemError / segmentation fault in iter `__reduce__` when internal access of `builtins.__dict__` exhausts the iterator (GH-101769) (#102228)
(cherry picked from commit 54dfa14c5a)
2023-02-24 19:49:59 -08:00
Miss Islington (bot) 9da3e7f389
[3.11] gh-95675: fix uid and gid at test_add_dir_getmember (gh-102207) (gh-102231)
gh-95675: fix uid and gid at test_add_dir_getmember (gh-102207)
(cherry picked from commit 56e93c8020)

Co-authored-by: Seonkyo Ok <seonkyo.ok@linecorp.com>
2023-02-25 11:55:48 +09:00
Miss Islington (bot) dd0843ac1d
gh-102158: Add tests for `softkwlist` (GH-102159)
---------

(cherry picked from commit 9f3ecd1aa3)

Co-authored-by: Eclips4 <80244920+Eclips4@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-02-23 18:54:47 -08:00
Miss Islington (bot) edbde8feb7
[3.11] gh-101936: Update the default value of fp from io.StringIO to io.BytesIO (gh-102100) (gh-102117)
gh-101936: Update the default value of fp from io.StringIO to io.BytesIO (gh-102100)
(cherry picked from commit 0d4c7fcd4f)

Co-authored-by: Long Vo <long.vo@linecorp.com>
2023-02-22 20:42:04 +09:00
Miss Islington (bot) 5d47150eac
[3.11] gh-95672 fix typo SkitTest to SkipTest (gh-102119) (#102121)
gh-95672 fix typo SkitTest to SkipTest (gh-102119)
(cherry picked from commit d5c7954d0c)

Co-authored-by: HyunKyun Moon <hyunkyun.moon@linecorp.com>
2023-02-22 10:34:51 +09:00
Miss Islington (bot) 3bfa608cbe
gh-102008: simplify test_except_star by using sys.exception() instead of sys.exc_info() (GH-102009)
(cherry picked from commit c2b85a95a5)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2023-02-21 07:38:27 -08:00
Miss Islington (bot) 5bc6927c68
[3.11] gh-101961 fileinput.hookcompressed should not set the encoding value for the binary mode (gh-102068) (#102098)
gh-101961 fileinput.hookcompressed should not set the encoding value for the binary mode (gh-102068)
(cherry picked from commit 6f25657b83)

Co-authored-by: Gihwan Kim <gihwan.kim@linecorp.com>
2023-02-21 12:39:16 +09:00
Jason R. Coombs d15e9589f3
[3.11] gh-101566: Sync with zipp 3.14. (GH-102018). (GH-102090)
(cherry picked from commit 36854bbb24)

Backport of bugfix only.

Automerge-Triggered-By: GH:jaraco
2023-02-20 15:22:03 -08:00
Miss Islington (bot) 62c0327487
gh-88233: zipfile: handle extras after a zip64 extra (GH-96161)
Previously, any data _after_ the zip64 extra would be removed.

With many new tests.

Fixes GH-88233
(cherry picked from commit 59e86caca8)

Co-authored-by: Tim Hatch <tim@timhatch.com>
Automerge-Triggered-By: GH:jaraco
2023-02-20 09:33:00 -08:00
Miss Islington (bot) b0bba7ad14
gh-101517: make bdb avoid looking up in linecache with lineno=None (GH-101787)
(cherry picked from commit 366b949058)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2023-02-10 09:26:27 -08:00
Miss Islington (bot) 5f0b819050
[3.11] gh-100933: Improve `check_element` helper in `test_xml_etree` (GH-100934) (#101686)
Items checked by this test are always `str` and `dict` instances.
(cherry picked from commit eb49d32b9a)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-02-08 12:11:54 +01:00
Oleg Iarygin efcab38699
[3.11] gh-96127: Fix `inspect.signature` call on mocks (#96335) (#101646)
(cherry picked from commit 9e7d7266ec)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-02-08 11:05:57 +01:00
Miss Islington (bot) c38b4e75b1
[3.11] Make use of TESTFN_ASCII in test_fileio (GH-101645) (#101650)
testBytesOpen requires an ASCII filename, but TESTFN usually isn't ASCII.
(cherry picked from commit 6fd5eb640a)

Co-authored-by: Zachary Ware <zach@python.org>
2023-02-08 11:05:36 +01:00
Łukasz Langa 955ba2839b
[3.11] gh-101072: support default and kw default in PyEval_EvalCodeEx for 3.11+ (GH-101127) (#101636)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Matthieu Dartiailh <m.dartiailh@gmail.com>
2023-02-07 13:36:35 +00:00
Mark Dickinson 358b02dac4
[3.11] gh-101266: Revert fix __sizeof__ for subclasses of int (#101638)
Revert "[3.11] gh-101266: Fix __sizeof__ for subclasses of int (GH-101394) (#101579)"

This reverts commit cf89c16486.
2023-02-07 11:44:43 +00:00
Miss Islington (bot) 9e7acafa14
gh-101562: typing: add tests for inheritance with NotRequired & Required in parent fields (GH-101563)
(cherry picked from commit b96b344f25)

Co-authored-by: Eclips4 <80244920+Eclips4@users.noreply.github.com>
2023-02-06 11:53:53 -08:00
Miss Islington (bot) cf8973c638
gh-101541: [Enum] create flag psuedo-member without calling original __new__ (GH-101590)
(cherry picked from commit ef7c2bfcf1)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-02-05 19:52:22 -08:00
Miss Islington (bot) 6ae80323df
gh-101334: Don't force USTAR format in test_tarfile. (GH-101572)
That causes the test to fail when run using a high UID as that ancient format
cannot represent it. The current default (PAX) and the old default (GNU) both
support high UIDs.
(cherry picked from commit ffcb8220d7)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-02-05 11:47:12 -08:00
Mark Dickinson cf89c16486
[3.11] gh-101266: Fix __sizeof__ for subclasses of int (GH-101394) (#101579)
Fix the behaviour of the `__sizeof__` method (and hence the results returned
by `sys.getsizeof`) for subclasses of `int`. Previously, `int` subclasses gave
identical results to the `int` base class, ignoring the presence of the instance
dictionary.

(Manual backport of #101394 to the Python 3.11 branch.)
2023-02-05 12:18:56 +00:00
Miss Islington (bot) e98fa7121d
gh-101467: Correct py.exe handling of prefix matches and cases when only one runtime is installed (GH-101468)
(cherry picked from commit eda60916bc)

Co-authored-by: Steve Dower <steve.dower@python.org>
2023-02-01 13:31:21 -08:00
Dong-hee Na 0c37ea9aba
[3.11] gh-101400: Fix incorrect lineno in exception message on contin… (gh-101447) 2023-01-31 23:53:14 +09:00
Miss Islington (bot) faf8068dd0
gh-101229: Add tests for aliases of imported names (GH-101230)
(cherry picked from commit 28db978d7f)

Co-authored-by: Eclips4 <80244920+Eclips4@users.noreply.github.com>
2023-01-30 12:21:18 -08:00
Shantanu cd0fe5ba09
[3.11] gh-101326: Fix regression when passing None to FutureIter.throw (GH-101327) (#101328)
(cherry picked from commit a178ba82bf)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-01-25 13:01:13 -08:00
Miss Islington (bot) 29ff9daf82
gh-101015: Fix `typing.get_type_hints` with unpacked `*tuple` (PEP 646) (GH-101031)
(cherry picked from commit 807d6b576f)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-01-23 00:20:15 -08:00
Gregory P. Smith efe3a389ca
[3.11] gh-101144: Allow zipfile.Path .open & .read_text encoding to be positional (#101179)
The zipfile.Path open() and read_text() encoding parameter can be supplied as a positional argument without causing a TypeError again. 3.10.0b1 included a regression that made it keyword only.

Documentation update included as users writing code to be compatible with a wide range of versions will need to consider this for some time..

(cherry picked from commit 5927013e47)

Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
2023-01-20 00:06:18 -08:00