summaryrefslogtreecommitdiff
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
* gh-103606: Improve error message from logging.config.FileConfig (GH-103628)HEADmainPrince Roshan2023-05-181-0/+36
|
* gh-104555: Runtime-checkable protocols: Don't let previous calls to ↵Alex Waygood2023-05-171-0/+76
| | | | | `isinstance()` influence whether `issubclass()` raises an exception (#104559) Co-authored-by: Carl Meyer <carl@oddbird.net>
* typing: Add more tests for TypeVar (#104571)Jelle Zijlstra2023-05-172-7/+49
| | | | | | | | 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. In the process I discovered a minor incompatibility from the C implementation of TypeVar: empty constraints were returned as None instead of an empty tuple.
* gh-104572: Improve error messages for invalid constructs in PEP 695 contexts ↵Jelle Zijlstra2023-05-171-0/+62
| | | | (#104573)
* gh-102153: Start stripping C0 control and space chars in `urlsplit` (#102508)Illia Volochii2023-05-171-1/+60
| | | | | | | | | `urllib.parse.urlsplit` has already been respecting the WHATWG spec a bit #25595. This adds more sanitizing to respect the "Remove any leading C0 control or space from input" [rule](https://url.spec.whatwg.org/#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). --------- Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
* gh-75367: Fix data descriptor detection in inspect.getattr_static (#104517)Furkan Onder2023-05-161-0/+3
| | | Co-authored-by: Carl Meyer <carl@oddbird.net>
* gh-104555: Fix isinstance() and issubclass() for runtime-checkable protocols ↵Alex Waygood2023-05-161-0/+18
| | | | | that use PEP 695 (#104556) Fixes #104555
* gh-103865: add monitoring support to LOAD_SUPER_ATTR (#103866)Carl Meyer2023-05-161-3/+220
|
* gh-103861: Fix Zip64 extensions not being properly applied in some cases ↵Carey Metcalfe2023-05-161-0/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#103863) 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 #103861 --------- Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-69152: add method get_proxy_response_headers to HTTPConnection class ↵Alexey Namyotkin2023-05-161-1/+1
| | | | | | | | | | (#104248) Add http.client.HTTPConnection method get_proxy_response_headers() - this is a followup to https://github.com/python/cpython/pull/26152 which added it as a non-public attribute. This way we don't pre-compute a headers dictionary that most users will never access. The new method is properly public and documented and triggers full proxy header parsing into a dict only when actually called. --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-103763: Implement PEP 695 (#103764)Jelle Zijlstra2023-05-157-80/+1164
| | | | | | | | | | | | | | This implements PEP 695, Type Parameter Syntax. It adds support for: - Generic functions (def func[T](): ...) - Generic classes (class X[T](): ...) - Type aliases (type X = ...) - New scoping when the new syntax is used within a class body - Compiler and interpreter changes to support the new syntax and scoping rules Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Eric Traut <eric@traut.com> Co-authored-by: Larry Hastings <larry@hastings.org> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-104461: Run tkinter test_configure_screen on X11 only (GH-104462)Christopher Chavez2023-05-151-0/+2
|
* gh-104482: Fix error handling bugs in ast.c (#104483)Irit Katriel2023-05-151-0/+6
|
* GH-102613: Fix recursion error from `pathlib.Path.glob()` (GH-104373)Barney Gale2023-05-151-0/+11
| | | | Use `Path.walk()` to implement the recursive wildcard `**`. This method uses an iterative (rather than recursive) walk - see GH-100282.
* gh-101819: Isolate `_io` (#101948)Erlend E. Aasland2023-05-151-2/+5
| | | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-104494: Update certain Tkinter pack/place tests for Tk 8.7 errors (#104495)Christopher Chavez2023-05-151-4/+6
| | | | Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* GH-71383: IDLE - Document testing subsets of modules (#104463)Terry Jan Reedy2023-05-131-5/+1
|
* gh-91896: Revert some very noisy DeprecationWarnings for `ByteString` (#104424)Alex Waygood2023-05-133-40/+13
|
* gh-104404: fix crasher with nested comprehensions plus lambdas (#104442)Carl Meyer2023-05-121-0/+8
|
* GH-104405: Add missing PEP 523 checks (GH-104406)Brandt Bucher2023-05-121-18/+70
|
* gh-103333: Pickle the keyword attributes of AttributeError (#103352)Charles Machalow2023-05-121-27/+34
| | | | | | * Pickle the `name` and `args` attributes of AttributeError when present. Co-authored-by: Gregory P. Smith <greg@krypto.org> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-103204: `http.server` - Enforce that HTTP version numbers must consist ↵Ben Kallus2023-05-121-0/+21
| | | | | | | | | | only of digits (#103205) Reject HTTP requests with invalid http/x.y version numbers: x or y being non-digits or too-long. --------- Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Gregory P. Smith <greg@krypto.org>
* GH-86275: Implementation of hypothesis stubs for property-based tests, with ↵Paul Ganssle2023-05-127-1/+621
| | | | | | | | | | | | | zoneinfo tests (#22863) These are stubs to be used for adding hypothesis (https://hypothesis.readthedocs.io/en/latest/) tests to the standard library. When the tests are run in an environment where `hypothesis` and its various dependencies are not installed, the stubs will turn any tests with examples into simple parameterized tests and any tests without examples are skipped. It also adds hypothesis tests for the `zoneinfo` module, and a Github Actions workflow to run the hypothesis tests as a non-required CI job. The full hypothesis interface is not stubbed out — missing stubs can be added as necessary. Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
* GH-103082: Filter LINE events in VM, to simplify tool implementation. ↵Mark Shannon2023-05-124-6/+65
| | | | | | | | (GH-104387) When monitoring LINE events, instrument all instructions that can have a predecessor on a different line. Then check that the a new line has been hit in the instrumentation code. This brings the behavior closer to that of 3.11, simplifying implementation and porting of tools.
* gh-104389: Add 'unused' keyword to Argument Clinic C converters (#104390)Erlend E. Aasland2023-05-121-0/+38
| | | | | | | | | Use the unused keyword param in the converter to explicitly mark an argument as unused: /*[clinic input] SomeBaseClass.stubmethod flag: bool(unused=True) [clinic start generated code]*/
* gh-91896: Improve visibility of `ByteString` deprecation warnings (#104294)Alex Waygood2023-05-113-11/+45
|
* gh-104371: Fix calls to `__release_buffer__` while an exception is active ↵Jelle Zijlstra2023-05-121-0/+13
| | | | | (#104378) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-104377: fix cell in comprehension that is free in outer scope (#104394)Carl Meyer2023-05-111-4/+55
|
* gh-99108: Refresh HACL* from upstream (#104401)Jonathan Protzenko2023-05-111-0/+9
| | | Refresh HACL* from upstream and add a SHA3 test hashing over 4GiB of data.
* gh-104301: Allow leading whitespace in disambiguated pdb statements (#104342)James Gerity2023-05-111-0/+23
|
* gh-104057: Fix direct invocation of test_support (GH-104069)Kirill Podoprigora2023-05-111-1/+1
|
* gh-104357: fix inlined comprehensions that close over iteration var (#104368)Carl Meyer2023-05-101-0/+10
|
* GH-90208: Suppress OSError exceptions from `pathlib.Path.glob()` (GH-104141)Barney Gale2023-05-111-26/+12
| | | | | | | | | | | `pathlib.Path.glob()` now suppresses all OSError exceptions, except those raised from calling `is_dir()` on the top-level path. Previously, `glob()` suppressed ENOENT, ENOTDIR, EBADF and ELOOP errors and their Windows equivalents. PermissionError was also suppressed unless it occurred when calling `is_dir()` on the top-level path. However, the selector would abort prematurely if a PermissionError was raised, and so `glob()` could return incomplete results.
* GH-87695: Fix OSError from `pathlib.Path.glob()` (GH-104292)Barney Gale2023-05-101-0/+9
| | | | Fix issue where `pathlib.Path.glob()` raised `OSError` when it encountered a symlink to an overly long path.
* gh-104263: Rely on Py_NAN and introduce Py_INFINITY (GH-104202)Sebastian Berg2023-05-104-6/+15
| | | | | | | | | | This PR removes `_Py_dg_stdnan` and `_Py_dg_infinity` in favour of using the standard `NAN` and `INFINITY` macros provided by C99. This change has the side-effect of fixing a bug on MIPS where the hard-coded value used by `_Py_dg_stdnan` gave a signalling NaN rather than a quiet NaN. --------- Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* gh-103247: clear the module cache in a test in ↵sunmy20192023-05-101-9/+10
| | | | test_importlib/extensions/test_loader.py (GH-104226)
* gh-103848: Adds checks to ensure that bracketed hosts found by urlsplit are ↵JohnJamesUtley2023-05-101-0/+26
| | | | | | | | | of IPv6 or IPvFuture format (#103849) * Adds checks to ensure that bracketed hosts found by urlsplit are of IPv6 or IPvFuture format --------- Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-74895: adjust tests to work on Solaris (#104326)Jakub Kulík2023-05-091-6/+6
| | | Solaris is unusual here, but apparently everyone is happy when SOCK_STREAM is explicitly specified.
* gh-97933: (PEP 709) inline list/dict/set comprehensions (#101441)Carl Meyer2023-05-096-94/+257
| | | | Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-99889: Fix directory traversal security flaw in uu.decode() (#104096)Sam Carroll2023-05-091-0/+28
| | | | | | | | | * Fix directory traversal security flaw in uu.decode() * also check absolute paths and os.altsep * Add a regression test. --------- Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
* gh-104139: Add itms-services to uses_netloc urllib.parse. (#104312)Gregory P. Smith2023-05-091-14/+19
| | | | Teach unsplit to retain the `"//"` when assembling `itms-services://?action=generate-bugs` style [Apple Platform Deployment](https://support.apple.com/en-gb/guide/deployment/depce7cefc4d/web) URLs.
* gh-104240: return code unit metadata from codegen (#104300)Irit Katriel2023-05-092-2/+2
|
* gh-103193: Fix refleaks in `test_inspect` and `test_typing` (#104320)Alex Waygood2023-05-091-0/+7
|
* gh-104310: Add importlib.util.allowing_all_extensions() (gh-104311)Eric Snow2023-05-082-0/+123
| | | (I'll be adding docs for this separately.)
* gh-104223: Fix issues with inheriting from buffer classes (#104227)Jelle Zijlstra2023-05-081-0/+170
| | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-103193: Improve `getattr_static` test coverage (#104286)Alex Waygood2023-05-081-0/+29
|
* gh-104265 Disallow instantiation of `_csv.Reader` and `_csv.Writer` (#104266)chgnrdv2023-05-071-1/+8
|
* GH-102613: Improve performance of `pathlib.Path.rglob()` (GH-104244)Barney Gale2023-05-071-1/+5
| | | | | | | | | | Stop de-duplicating results in `_RecursiveWildcardSelector`. A new `_DoubleRecursiveWildcardSelector` class is introduced which performs de-duplication, but this is used _only_ for patterns with multiple non-adjacent `**` segments, such as `path.glob('**/foo/**')`. By avoiding the use of a set, `PurePath.__hash__()` is not called, and so paths do not need to be stringified and case-normalised. Also merge adjacent '**' segments in patterns.
* gh-103650: Fix perf maps address format (#103651)Arthur Pastel2023-05-071-3/+9
|
* gh-104240: make _PyCompile_CodeGen support different compilation modes (#104241)Irit Katriel2023-05-071-0/+4
|