Commit graph

28977 commits

Author SHA1 Message Date
Miss Islington (bot)
c2e51a9985
[3.11] gh-105436: Ignore unrelated errors when checking empty env (GH-105742) (#105757)
gh-105436: Ignore unrelated errors when checking empty env (GH-105742)
(cherry picked from commit 4cefe3cf10)

Co-authored-by: Steve Dower <steve.dower@python.org>
2023-06-13 23:39:56 +00:00
Miss Islington (bot)
261d0b4f0e
[3.11] gh-105436: The environment block should end with two null wchar_t values (GH-105495) (#105701)
gh-105436: The environment block should end with two null wchar_t values (GH-105495)
(cherry picked from commit 4f7d3b602d)

Co-authored-by: Dora203 <66343334+sku2000@users.noreply.github.com>
2023-06-12 16:49:57 +00:00
Miss Islington (bot)
6dcbd50eb8
[3.11] gh-105557: Remove duplicate sqlite3 test method (GH-105558) (#105562)
test_func_return_too_large_int() was defined twice.
Keep only the redefined method, as that also checks the tracebacks.
(cherry picked from commit b8fa7bda4f)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-06-09 14:02:15 +00:00
Miss Islington (bot)
fed1b5a198
[3.11] gh-105332: [Enum] Fix unpickling flags in edge-cases (GH-105348) (GH-105519)
* revert enum pickling from by-name to by-value

(cherry picked from commit 4ff5690e59)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-06-08 18:02:12 -07:00
Miss Islington (bot)
b073b30cae
[3.11] test_types: Replace raw assert statements (GH-105500) (#105508)
(cherry picked from commit a8eb7372ee)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-06-08 15:33:40 +00:00
Alex Waygood
18e9fd80d9
[3.11] gh-103171: Revert undocumented behaviour change for runtime-checkable protocols decorated with @final (#105445) 2023-06-07 21:18:21 +00:00
Miss Islington (bot)
daf22ca7f9
[3.11] gh-104411: Update test_getint for Tcl 9.0 (GH-104412) (#105357)
gh-104411: Update test_getint for Tcl 9.0 (GH-104412)
(cherry picked from commit 2c49c759e8)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
2023-06-06 10:04:21 -04:00
Jelle Zijlstra
48957888d2
[3.11] gh-105164: Detect annotations inside match blocks (GH-105177). (#105314)
(cherry picked from commit 69d1245685)
2023-06-05 13:46:12 +00:00
Tian Gao
aca77b5530
[3.11] gh-105080: Fixed inconsistent signature on derived classes (GH… (#105274) 2023-06-04 15:26:01 -06:00
Miss Islington (bot)
ca5524745d
[3.11] Remove raw asserts in test_typing.py (GH-104951) (#104979)
Remove raw asserts in test_typing.py (GH-104951)
(cherry picked from commit 2cb445635e)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-26 14:34:37 +00:00
Miss Islington (bot)
76873ca6b1
[3.11] Fix test_importlib.test_side_effect_import() (GH-104840) (#104843)
Fix test_importlib.test_side_effect_import() (GH-104840)

Wait until the thread spawn by the import completes to avoid dangling
threads. With this fix, the following command no longer fails:

./python -m test --fail-env-changed test_importlib -m test_side_effect_import -F -j20
(cherry picked from commit 426950993f)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-05-25 02:35:34 +02:00
Miss Islington (bot)
5e911673e4
[3.11] Improve test coverage for is_typeddict (GH-104884) (#104888)
In particular, it's important to test that is_typeddict(TypedDict)
returns False.
(cherry picked from commit 1497607a8e)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-24 19:23:35 +00:00
Miss Islington (bot)
582aadc80e
[3.11] gh-104271: Fix auto() fallback in case of mixed type Enum (GH-104809)
[3.12] gh-104271: Fix auto() fallback in case of mixed type Enum (GH-104279)
(cherry picked from commit f4e2049f14)

Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
2023-05-23 12:48:20 -07:00
Alex Waygood
d691de1d2d
[3.11] gh-104683: clinic.py: Improve coverage for the parse_converter method (#104729) (#104730) 2023-05-21 23:48:25 +00:00
Prince Roshan
2ade563abc
[3.11] gh-103606: Improve error message from logging.config.FileConfig (GH-103628) (#104687)
* gh-103606: Improve error message from logging.config.FileConfig (GH-103628)

(cherry picked from commit 152227b569)

plus backport the followup exception change fix to that in #104701
2023-05-21 12:17:18 -07:00
Miss Islington (bot)
795b20e2f1
[3.11] gh-56276: Add tests to test_compare (GH-3199) (#104694)
gh-56276: Add tests to test_compare (GH-3199)
(cherry picked from commit 68ee8b3f15)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-05-20 16:31:42 +00:00
Miss Islington (bot)
dbb011afae
[3.11] gh-103987: fix several crashes in mmap module (GH-103990) (#104677)
gh-103987: fix several crashes in mmap module (GH-103990)
(cherry picked from commit ceaa4c3476)

Co-authored-by: Prince Roshan <princekrroshan01@gmail.com>
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-20 03:59:54 +00:00
Miss Islington (bot)
2801b3f8f7
[3.11] gh-104472: Skip test_subprocess.ProcessTestCase.test_empty_env if ASAN is enabled (GH-104667) (#104673)
gh-104472: Skip `test_subprocess.ProcessTestCase.test_empty_env` if ASAN is enabled (GH-104667)

Skip test_subprocess.ProcessTestCase.test_empty_env if ASAN is enabled.
(cherry picked from commit c3f43bfb4b)

Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
2023-05-19 21:48:07 +00:00
Mark Shannon
7b3bc95067
[3.11] GH-102818: Do not call PyTraceBack_Here in sys.settrace trampoline (GH-104650)
Backport of GH-104579
2023-05-19 19:08:43 +01:00
Carl Meyer
667e4ece98
[3.11] gh-104615: don't make unsafe swaps in apply_static_swaps (GH-104620). (#104636)
(cherry picked from commit 0589c6a4d3)
2023-05-19 12:04:04 -06:00
Łukasz Langa
702ce87736
[3.11] gh-96522: Fix deadlock in pty.spawn (GH-96639) (#104655)
(cherry picked from commit 9c5aa8967b)

Co-authored-by: Youfu Zhang <1315097+zhangyoufu@users.noreply.github.com>
2023-05-19 16:54:50 +02:00
Miss Islington (bot)
aaeaf01cc2
[3.11] gh-85984: Utilize new "winsize" functions from termios in pty tests. (GH-101831) (#104652)
Utilize new functions termios.tcgetwinsize() and termios.tcsetwinsize in test_pty.py.

(cherry picked from commit da2fb92643)

Co-authored-by: Soumendra Ganguly <67527439+8vasu@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-05-19 15:57:52 +02:00
Miss Islington (bot)
3d52f7e60c
[3.11] gh-104629: Don't skip test_clinic if _testclinic is missing (GH-104630) (#104632)
gh-104629: Don't skip test_clinic if _testclinic is missing (GH-104630)

Just skip the tests that depend on the _testclinic extension module;
we can still run the Python tests.
(cherry picked from commit 86ee49f469)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-18 23:20:35 +00:00
Miss Islington (bot)
610cc0ab1b
[3.11] gh-102153: Start stripping C0 control and space chars in urlsplit (GH-102508) (#104575)
* gh-102153: Start stripping C0 control and space chars in `urlsplit` (GH-102508)

`urllib.parse.urlsplit` has already been respecting the WHATWG spec a bit GH-25595.

This adds more sanitizing to respect the "Remove any leading C0 control or space from input" [rule](https://url.spec.whatwg.org/GH-url-parsing:~:text=Remove%20any%20leading%20and%20trailing%20C0%20control%20or%20space%20from%20input.) in response to [CVE-2023-24329](https://nvd.nist.gov/vuln/detail/CVE-2023-24329).

---------

(cherry picked from commit 2f630e1ce1)

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
2023-05-17 21:41:25 +00:00
Jelle Zijlstra
f106aef24a
[3.11] typing: Add more tests for TypeVar (GH-104571) (#104577)
During the PEP 695 implementation at one point I made
TypeVar.__name__ return garbage, and all of test_typing passed.
So I decided to add a few more tests.
(cherry picked from commit 26931944dd)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-17 13:40:34 +00:00
Gregory P. Smith
133bf0927e
[3.11] gh-103861: Fix Zip64 extensions not being properly applied in some cases (GH-103863) (#104534)
Fix Zip64 extensions not being properly applied in some cases:

Fixes an issue where adding a small file to a `ZipFile`
object while forcing zip64 extensions causes an extra Zip64 record to be
added to the zip, but doesn't update the `min_version` or file sizes in
the primary central directory header.

Also fixed an edge case in checking if zip64 extensions are required:

This fixes an issue where if data requiring zip64 extensions was added
to an unseekable stream without specifying `force_zip64=True`, zip64
extensions would not be used and a RuntimeError would not be raised when
closing the file (even though the size would be known at that point).
This would result in successfully writing corrupt zip files.

Deciding if zip64 extensions are required outside of the `FileHeader`
function means that both `FileHeader` and `_ZipWriteFile` will always be
in sync. Previously, the `FileHeader` function could enable zip64
extensions without propagating that decision to the `_ZipWriteFile`
class, which would then not correctly write the data descriptor record
or check for errors on close.

If anyone is actually using `ZipInfo.FileHeader` as a public API without
explicitly passing True or False in for zip64, their own code may still be
susceptible to that kind of bug unless they make a similar change to
where the zip64 decision happens.

Fixes GH-103861

---------

.
(cherry picked from commit 798bcaa1eb)

Co-authored-by: Carey Metcalfe <carey@cmetcalfe.ca>
2023-05-17 01:07:10 -07:00
Miss Islington (bot)
f748fc9f44
[3.11] gh-75367: Fix data descriptor detection in inspect.getattr_static (GH-104517) (#104557)
gh-75367: Fix data descriptor detection in inspect.getattr_static (GH-104517)
(cherry picked from commit 5e9f471e7d)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-05-16 17:57:34 +00:00
Irit Katriel
52a18feaaa
[3.11] gh-104482: Fix error handling bugs in ast.c (#104514) 2023-05-16 10:14:36 +01:00
Miss Islington (bot)
03f0d75f1d
[3.11] GH-71383: IDLE - Document testing subsets of modules (GH-104463) (#104464)
GH-71383: IDLE - Document testing subsets of modules (GH-104463)
(cherry picked from commit 080a596152)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-05-14 04:18:30 +00:00
Brandt Bucher
fbb6def08a
[3.11] GH-104405: Add missing PEP 523 checks (GH-104441) 2023-05-12 23:03:47 +00:00
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