Commit Graph

28947 Commits

Author SHA1 Message Date
Miss Islington (bot) b4c1ca29cc
[3.11] gh-103204: `http.server` - Enforce that HTTP version numbers must consist only of digits (GH-103205) (#104438)
gh-103204: `http.server` - Enforce that HTTP version numbers must consist only of digits (GH-103205)

Reject HTTP requests with invalid http/x.y version numbers: x or y being non-digits or too-long.

---------

(cherry picked from commit cf720acfcb)

Co-authored-by: Ben Kallus <49924171+kenballus@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-05-12 20:54:12 +00:00
Miss Islington (bot) 846a23d0b8
[3.11] GH-87695: Fix OSError from `pathlib.Path.glob()` (GH-104292) (GH-104362)
Fix issue where `pathlib.Path.glob()` raised `OSError` when it encountered
a symlink to an overly long path.
(cherry picked from commit a33ce66dca)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2023-05-10 23:19:49 +00:00
Miss Islington (bot) 1cbf844875
[3.11] gh-103247: clear the module cache in a test in test_importlib/extensions/test_loader.py (GH-104226) (#104345)
gh-103247: clear the module cache in a test in test_importlib/extensions/test_loader.py (GH-104226)
(cherry picked from commit 22f3425c3d)

Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
2023-05-10 07:53:19 -07:00
Miss Islington (bot) b2171a2fd4
[3.11] gh-103848: Adds checks to ensure that bracketed hosts found by urlsplit are of IPv6 or IPvFuture format (GH-103849) (#104349)
gh-103848: Adds checks to ensure that bracketed hosts found by urlsplit are of IPv6 or IPvFuture format (GH-103849)

* Adds checks to ensure that bracketed hosts found by urlsplit are of IPv6 or IPvFuture format

---------

(cherry picked from commit 29f348e232)

Co-authored-by: JohnJamesUtley <81572567+JohnJamesUtley@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-05-10 06:35:24 +00:00
Miss Islington (bot) 4ed59b1f33
[3.11] gh-99889: Fix directory traversal security flaw in uu.decode() (GH-104096) (#104329)
gh-99889: Fix directory traversal security flaw in uu.decode() (GH-104096)

* Fix directory traversal security flaw in uu.decode()
* also check absolute paths and os.altsep
* Add a regression test.

---------

(cherry picked from commit 0aeda29793)


 [Google]

Co-authored-by: Sam Carroll <70000253+samcarroll42@users.noreply.github.com>
2023-05-09 09:46:25 -07:00
Miss Islington (bot) d54f6441ce
[3.11] gh-103193: Improve `getattr_static` test coverage (GH-104286) (#104290)
gh-103193: Improve `getattr_static` test coverage (GH-104286)
(cherry picked from commit 921185ed05)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-08 14:44:10 +00:00
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