Commit Graph

27588 Commits

Author SHA1 Message Date
Andrew Svetlov 9f5145403b
[3.10] Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253) (GH-31255)
(cherry picked from commit 012e77eb5c)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-02-10 15:27:15 +02:00
Pablo Galindo Salgado 9b23f8f78f
[3.10] bpo-46707: Avoid potential exponential backtracking in some syntax errors (GH-31241). (GH-31242)
(cherry picked from commit b71dc71905)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-02-10 03:54:47 +00:00
Miss Islington (bot) 42f87d435e
bpo-45863: tarfile: don't zero out header fields unnecessarily (GH-29693)
Numeric fields of type float, notably mtime, can't be represented
exactly in the ustar header, so the pax header is used. But it is
helpful to set them to the nearest int (i.e. second rather than
nanosecond precision mtimes) in the ustar header as well, for the
benefit of unarchivers that don't understand the pax header.

Add test for tarfile.TarInfo.create_pax_header to confirm correct
behaviour.
(cherry picked from commit bf2d44ffb0)

Co-authored-by: Joshua Root <jmr@macports.org>
2022-02-09 09:31:12 -08:00
Miss Islington (bot) d29bbc22b0
bpo-46685: cover `TypeError` of `ForwardRef(1)` in `test_typing` (GH-31223)
(cherry picked from commit d2d1d49eac)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-09 07:12:17 -08:00
Miss Islington (bot) c2735b75af
bpo-46678: Fix Invalid cross device link in Lib/test/support/import_helper.py (GH-31204) (GH-31207)
In `Lib/test/support/import_helper.py`, the function `make_legacy_pyc` makes a call to `os.rename` which can fail when the source and target live on different devices. This happens (for example) when `PYTHONPYCACHEPREFIX` is set to a directory anywhere on disk, while a ramdisk is mounted on `/tmp` (the latter of which is the default on various Linux distros). Replacing `os.rename` with `shutil.move` fixes this.

Automerge-Triggered-By: GH:brettcannon
(cherry picked from commit da576e0829)

Co-authored-by: Jason Wilkes <notarealdeveloper@gmail.com>
2022-02-08 13:04:05 -08:00
Gregory Beauregard cbdcae5ab9
[3.10] bpo-46676: Make ParamSpec args and kwargs equal to themselves (GH-31203) (GH-31210)
(cherry picked from commit c8b62bbe46)

Co-authored-by: Gregory Beauregard <greg@greg.red>
2022-02-08 10:41:13 +02:00
Miss Islington (bot) 9539400390
[3.10] bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186) (GH-31189)
Re-enable test_issue16464() of test_urllib2, move it to urllib2_localnet
and use the local HTTP server rather than an external HTTP server.
(cherry picked from commit 8e98175a03)


Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-07 12:15:22 -08:00
Gregory Beauregard e2eeffefed
[3.10] bpo-46655: allow stringized TypeAlias with get_type_hints (GH-31156). (#31175)
(cherry picked from commit 77b025be4a)

Co-authored-by: Gregory Beauregard <greg@greg.red>
2022-02-07 08:21:56 -08:00
Nikita Sobolev c1ff4cb98b
[3.10] bpo-46611: add coverage to instance and class checks in `typing.py` (GH-31078) (GH-31182)
(cherry picked from commit 067c03bf40)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-07 10:48:20 +02:00
Miss Islington (bot) cb789944b2
Add more tests for variable substitution in generics (GH-31170)
(cherry picked from commit 3da5526136)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-02-06 12:15:29 -08:00
Miss Islington (bot) c88407ccf5
bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161)
POST requests to http://www.example.com/ fail randomly.
(cherry picked from commit 1578de2fcd)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-02-06 06:33:01 -08:00
Miss Islington (bot) 34895f694c
Optimize images by IMGbot (GH-21348)
Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
(cherry picked from commit ba650af7d6)
2022-02-04 16:31:21 +09:00
Miss Islington (bot) 5765eaa136
bpo-46616: Ensures test_importlib.test_windows cleans up registry keys after completion (GH-31086)
(cherry picked from commit 89a0a90c2e)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-02-02 12:25:37 -08:00
Miss Islington (bot) 85b421fbff
bpo-44359: Fix test_ftplib unhandled thread exceptions (GH-31069)
test_ftplib now silently ignores socket errors to prevent logging
unhandled threading exceptions.
(cherry picked from commit 0611eafc70)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-02-01 18:12:27 -08:00
Miss Islington (bot) 1dcd772804
bpo-44031: fix test_tabnanny failure in non-ascii CWD (GH-31014)
(cherry picked from commit 108e66b6d2)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-02-01 03:20:07 -08:00
Miss Islington (bot) 6a188d88c5
bpo-46482: add a test for `typing.Annotation.__new__` (GH-30821)
(cherry picked from commit 4c0612ad00)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-01 02:27:36 -08:00
Kumar Aditya a5451c96a1
bpo-26552: Fixed case where failing `asyncio.ensure_future` did not close the coroutine (#30288) (#31003) 2022-01-28 22:57:18 -08:00
Miss Islington (bot) 95b70e2ccf
bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (GH-30913)
(cherry picked from commit c27a33132b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-28 08:56:50 -08:00
Miss Islington (bot) 20f5313667
bpo-46542: test_json uses support.infinite_recursion() (GH-30972)
Fix test_json tests checking for RecursionError: modify these tests
to use support.infinite_recursion().
(cherry picked from commit e7a6285f1b)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-01-27 16:57:07 -08:00
Miss Islington (bot) bfcb41420a
bpo-46539: Pass status of special typeforms to forward references (GH-30926)
Previously this didn't matter because there weren't any valid code paths
that could trigger a type check with a special form, but after the bug
fix for `Annotated` wrapping special forms it's now possible to annotate
something like `Annotated['ClassVar[int]', (3, 4)]`. This change would
also be needed for proposed future changes, such as allowing `ClassVar`
and `Final` to nest each other in dataclasses.
(cherry picked from commit ced50051bb)

Co-authored-by: Gregory Beauregard <greg@greg.red>
2022-01-27 08:48:08 -08:00
Miss Islington (bot) 486a4b3829
bpo-44734: Fix floating point precision in test_turtle (GH-30910)
(cherry picked from commit aa78287bc6)

Co-authored-by: Karolina Surma <33810531+befeleme@users.noreply.github.com>
2022-01-27 06:21:15 -08:00
Petr Viktorin 5c39e474db
[3.10] bpo-45703: Invalidate _NamespacePath cache on importlib.invalidate_cache (GH-29384) (GH-30922)
Consider the following directory structure:

    .
    └── PATH1
        └── namespace
            └── sub1
                └── __init__.py

And both PATH1 and PATH2 in sys path:

    $ PYTHONPATH=PATH1:PATH2 python3.11
    >>> import namespace
    >>> import namespace.sub1
    >>> namespace.__path__
    _NamespacePath(['.../PATH1/namespace'])
    >>> ...

While this interpreter still runs, PATH2/namespace/sub2 is created:

    .
    ├── PATH1
    │   └── namespace
    │       └── sub1
    │           └── __init__.py
    └── PATH2
        └── namespace
            └── sub2
                └── __init__.py

The newly created module cannot be imported:

    >>> ...
    >>> namespace.__path__
    _NamespacePath(['.../PATH1/namespace'])
    >>> import namespace.sub2
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'namespace.sub2'

Calling importlib.invalidate_caches() now newly allows to import it:

    >>> import importlib
    >>> importlib.invalidate_caches()
    >>> namespace.__path__
    _NamespacePath(['.../PATH1/namespace'])
    >>> import namespace.sub2
    >>> namespace.__path__
    _NamespacePath(['.../PATH1/namespace', '.../PATH2/namespace'])

This was not previously possible.
2022-01-27 06:00:23 -08:00
Miss Islington (bot) 89db090295
bpo-44791: Fix substitution of ParamSpec in Concatenate with different parameter expressions (GH-27518)
* Substitution with a list of types returns now a tuple of types.
* Substitution with Concatenate returns now a Concatenate with
  concatenated lists of arguments.
* Substitution with Ellipsis is not supported.
(cherry picked from commit ecfacc362d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-01-27 05:01:24 -08:00
Miss Islington (bot) 2572c670d4
[3.10] bpo-23556: [doc] Fix inaccuracy in documentation for raise without args. Improve tests for context in nested except handlers. (GH-29236) (GH-30953)
(cherry picked from commit 08c0ed2d9c)


Co-authored-by: Kinshuk Dua <kinshukdua@gmail.com>

Automerge-Triggered-By: GH:iritkatriel
2022-01-27 02:51:06 -08:00
Miss Islington (bot) c730342005
bpo-46529: increase coverage of `typing.Union.__repr__` method (GH-30911)
(cherry picked from commit d0c690b5f8)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-26 02:39:40 -08:00
Pablo Galindo Salgado 3fc8b74ace
[3.10] bpo-46091: Correctly calculate indentation levels for whitespace lines with continuation characters (GH-30130). (GH-30898)
(cherry picked from commit a0efc0c196)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-01-25 22:33:57 +00:00
Victor Stinner 4a57fa296b
[3.10] bpo-45382: test.pythoninfo logs more Windows versions (GH-30891)
Add the following info to test.pythoninfo:

* windows.ver: output of the shell "ver" command
* windows.version and windows.version_caption: output of the
  "wmic os get Caption,Version /value" command.

(cherry picked from commit b0898f4aa9)

* bpo-45382: test.pythoninfo: set wmic.exe encoding to OEM (GH-30890)

(cherry picked from commit cef0a5458f)
2022-01-25 21:20:34 +01:00
Miss Islington (bot) 75d88b91e6
bpo-41682: fixed flaky test test_sendfile_close_peer_in_the_middle_of_receiving (GH-30845) (#30860)
(cherry picked from commit 1c705fda8f)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-01-25 18:40:13 +01:00
Ken Jin 9a7d010467
[3.10] bpo-46445, bpo-46519: Re-import typing.NewType (GH-30886)
Partially reverts 65b88d5e01.
2022-01-25 23:31:12 +08:00
Miss Islington (bot) 41e0aead3d
bpo-46491: Allow Annotated on outside of Final/ClassVar (GH-30864)
We treat Annotated type arg as class-level annotation. This exempts it from checks against Final and ClassVar in order to allow using them in any nesting order.

Automerge-Triggered-By: GH:gvanrossum
(cherry picked from commit e1abffca45)

Co-authored-by: Gregory Beauregard <greg@greg.red>
2022-01-25 06:38:45 -08:00
Miss Islington (bot) 894e8c1348
bpo-46503: Prevent an assert from firing when parsing some invalid \N sequences in f-strings. (GH-30865) (GH-30866)
* bpo-46503: Prevent an assert from firing.  Also fix one nearby tiny PEP-7 nit.

* Added blurb.
(cherry picked from commit 0daf72194b)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2022-01-24 22:13:11 -05:00
Nikita Sobolev eaeb994680
[3.10] bpo-46416: Allow direct invocation of `Lib/test/test_typing.py` (GH-30641) (GH-30697)
Use `__name__`
(cherry picked from commit 2792d6d18e)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-25 00:18:38 +08:00
Miss Islington (bot) b2c7fe1f61
Improve grouper() recipe to demonstrate all forms of zip() (GH-30837) (GH-30840) 2022-01-23 16:02:31 -06:00
Pablo Galindo Salgado 633db1c4eb
[3.10] bpo-46240: Correct the error for unclosed parentheses when the tokenizer is not finished (GH-30378). (GH-30819)
(cherry picked from commit 70f415fb8b)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-01-23 03:10:37 +00:00
Miss Islington (bot) f66ef3eab6
bpo-46266: Add calendar day of week constants to __all__ (GH-30412) (GH-30424)
(cherry picked from commit e5894ca8fd)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-23 02:00:11 +01:00
Miss Islington (bot) 486b4d3d8e
bpo-41682: Skip unstable test_asyncio sendfile test on Windows (GH-30801) (GH-30812)
(cherry picked from commit 1ded8ed8e8)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-23 01:58:16 +01:00
Miss Islington (bot) 83aef4d340
bpo-43118: Fix bug in inspect.signature around 'base.__text_signature__' (GH-30285) (#30765)
(cherry picked from commit 881a763cfe)

Co-authored-by: Weipeng Hong <hongweichen8888@sina.com>

Co-authored-by: Weipeng Hong <hongweichen8888@sina.com>
2022-01-22 09:28:48 -08:00
Miss Islington (bot) 6111d5dee2
bpo-46425: fix direct invocation of `asyncio` tests (GH-30725) (#30782)
(cherry picked from commit 5a5340044c)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-22 14:29:51 +02:00
Miss Islington (bot) 90e2998db7
[3.10] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) (#30784)
* bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777)

* bpo-46469: Make asyncio generic classes return GenericAlias

* 📜🤖 Added by blurb_it.

* Update Misc/NEWS.d/next/Library/2022-01-22-05-05-08.bpo-46469.plUab5.rst

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit ea5b96842e)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>

* Fix tests

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-01-22 14:28:51 +02:00
Miss Islington (bot) d4a9e34401
bpo-46442: improve and rename testExceptionCleanupNames (GH-30758)
The test tested that explicitly deleting the local variable bound to the exception
did not cause problems, but it did not test what it actually claimed to test, i.e.
that the variable is deleted automatically.
(cherry picked from commit 82c53229e1)

Co-authored-by: Yellow Dusk <yellow.dusk1590@fastmail.com>
2022-01-21 23:34:29 -08:00
Miss Islington (bot) 46e6aad129
bpo-46445: Cover multiple inheritance of `TypedDict` in `test_typing` (GH-30719)
(cherry picked from commit 65b88d5e01)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-21 14:37:52 -08:00
Miss Islington (bot) 05063fa15c
bpo-46434: Handle missing docstrings in pdb help (GH-30705)
(cherry picked from commit 60705cff70)

Co-authored-by: Tom Sparrow <793763+sparrowt@users.noreply.github.com>
2022-01-21 11:32:43 -08:00
Miss Islington (bot) a1015c6478
bpo-46426: Improve tests for the dir_fd argument (GH-30668) (GH-30739)
Ensure that directory file descriptors refer to directories different
from the current directory, and that src_dir_fd and dst_dir_fd refer
to different directories.

Add context manager open_dir_fd() in test.support.os_helper.
(cherry picked from commit 54610bb448)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-01-21 19:31:25 +02:00
Miss Islington (bot) 1d11fdd3ee
bpo-21987: Fix TarFile.getmember getting a dir with a trailing slash (GH-30283)
(cherry picked from commit cfadcc31ea)

Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
2022-01-21 00:05:57 -08:00
Miss Islington (bot) e5edc8d737
bpo-46080: fix argparse help generation exception in edge case (GH-30111)
Fix an uncaught exception during help text generation when
argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS
and help is specified.
(cherry picked from commit 9e87c0e03f)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-01-20 15:13:17 -08:00
Miss Islington (bot) 1fb1f5d8bd
[3.10] bpo-46339: Fix crash in the parser when computing error text for multi-line f-strings (GH-30529) (GH-30542)
* bpo-46339: Fix crash in the parser when computing error text for multi-line f-strings (GH-30529)

Automerge-Triggered-By: GH:pablogsal
(cherry picked from commit cedec19be8)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>

* Fix interactive mode

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-01-20 13:05:10 +00:00
Nikita Sobolev a6a0885480
[3.10] bpo-46425: Fix direct invocation of multiple test modules (GH-30666) (GH-30699) 2022-01-20 10:44:21 +09:00
Miss Islington (bot) 07b12fdf55
bpo-46437: remove useless `hasattr` from `test_typing` (GH-30704)
(cherry picked from commit 263c0dd160)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-19 14:30:07 -08:00
Miss Islington (bot) 39374c44d9
[3.10] bpo-46413: properly test `__{r}or__` code paths in `_SpecialGenericAlias` (GH-30640) (GH-30694)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit 0a49148e87)


Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

Automerge-Triggered-By: GH:Fidget-Spinner
2022-01-19 08:11:12 -08:00
Miss Islington (bot) baf26d07a6
bpo-46424: [typing] cover `Annotation[arg]` invalid usage in tests (GH-30663)
(cherry picked from commit 32398294fb)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-19 07:54:07 -08:00