Commit Graph

28991 Commits

Author SHA1 Message Date
Miss Islington (bot) 3f244b2f6e
[3.11] gh-105497: [Enum] Fix Flag inversion when alias/mask members exist. (GH-105542) (#105571)
When inverting a Flag member (or boundary STRICT), only consider other canonical flags; when inverting an IntFlag member (or boundary KEEP), also consider aliases.
(cherry picked from commit 59f009e589)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-07-05 13:59:18 +02:00
Miss Islington (bot) 33fb89552b
[3.11] gh-89392: Make test_decimal discoverable (GH-106209) (#106229)
(cherry picked from commit 0e24499129)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-07-05 13:00:56 +02:00
Miss Islington (bot) edb29f0fbe
[3.11] gh-104683: Rename Lib/test/clinic.test as Lib/test/clinic.test.c (GH-106443) (#106445)
gh-104683: Rename Lib/test/clinic.test as Lib/test/clinic.test.c (GH-106443)
(cherry picked from commit a941bd6c53)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-05 09:03:25 +00:00
Miss Islington (bot) 9f8aa7a6d7
[3.11] gh-106368: Add tests for permutation helpers in Argument Clinic (GH-106407) (#106410)
Added new test class PermutationTests()
(cherry picked from commit 8f6df5e9cb)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-04 14:17:26 +02:00
Miss Islington (bot) 3cc5c4a073
[3.11] gh-106368: Increase Argument Clinic test coverage (GH-106389) (#106391)
Add:

- test_disallowed_gropuing__no_matching_bracket
- test_double_slash
(cherry picked from commit 3406f8cce5)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-04 00:22:32 +00:00
Miss Islington (bot) 76889641e6
[3.11] gh-106368: Harden Argument Clinic parser tests (GH-106384) (#106388)
(cherry picked from commit 648688c137)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-03 23:35:42 +00:00
Erlend E. Aasland 3fdda976db
[3.11] gh-106368: Clean up Argument Clinic tests (#106373) (#106381)
(cherry picked from commit 3ee8dac7a1)
2023-07-03 22:33:45 +00:00
Erlend E. Aasland 52d5049cfd
[3.11] gh-106368: Increase Argument Clinic test coverage (#106369) (#106374)
Add tests for 'self' and 'defining_class' converter requirements.
(cherry picked from commit 7f4c8121db)
2023-07-03 22:07:05 +00:00
Miss Islington (bot) 9e33586018
[3.11] gh-102541: Fix Helper.help("mod") for non-existent mod (GH-105934) (#106323)
gh-102541: Fix Helper.help("mod") for non-existent mod (GH-105934)

If the output arg to Helper() is a stream rather than the default None, which means 'page to stdout', the ImportError from pydoc.resolve is currently not caught in pydoc.doc. The same error is caught when output is None.
---------

(cherry picked from commit 0530f4f646)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-07-01 23:15:44 +00:00
Victor Stinner d5418e97fc
[3.11] gh-101634: regrtest reports decoding error as failed test (#106169) (#106175)
gh-101634: regrtest reports decoding error as failed test (#106169)

When running the Python test suite with -jN option, if a worker stdout
cannot be decoded from the locale encoding report a failed testn so the
exitcode is non-zero.

(cherry picked from commit 2ac3eec103)
2023-06-28 02:58:34 +00:00
Kumar Aditya 307c59a0c1
[3.11] gh-105979: Fix exception handling in unmarshal_frozen_code (`Python/import.c`) (GH-105980). (#106100)
* [3.11] gh-105979: Fix exception handling in `unmarshal_frozen_code` (`Python/import.c`) (GH-105980).
(cherry picked from commit cd5280367a)

Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
2023-06-26 09:00:51 +00:00
Miss Islington (bot) 2944a6cc0a
[3.11] GH-105840: Fix assertion failures when specializing calls with too many __defaults__ (GH-105864)
GH-105840: Fix assertion failures when specializing calls with too many __defaults__ (GH-105847)
(cherry picked from commit 2beab5bdef)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2023-06-16 18:30:22 +00:00
Alex Waygood e590338893
[3.11] gh-105834: Backport new tests for `typing.Protocol` (#105835) (#105860) 2023-06-16 16:39:12 +00:00
Miss Islington (bot) c0c4186858
[3.11] GH-105588: Add missing error checks to some obj2ast_* converters (GH-105839)
GH-105588: Add missing error checks to some obj2ast_* converters (GH-105589)
(cherry picked from commit a4056c8f9c)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2023-06-15 23:13:51 +00:00
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