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>
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>
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>
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>
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>
* 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>
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)
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>
* 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>
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>
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>
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>
* 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>
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