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>
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>
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>
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>
gh-103193: Improve `getattr_static` test coverage (GH-104286)
(cherry picked from commit 921185ed05)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
`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>
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>
gh-103746: Test `types.UnionType` and `Literal` types together (GH-103747)
(cherry picked from commit 3d29edaf0a)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
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>
* 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>
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>
STRICT boundary:
- fix bitwise operations
- make default for Flag
(cherry picked from commit 2194071540)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
* 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>