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>
@pablogsal, sorry i failed to rebase to main, so i recreated https://github.com/python/cpython/pull/22190GH-issuecomment-1024633392
> PyRun_InteractiveOne\*() functions allow to explicitily set fd instead of stdin.
but stdin was hardcoded in readline call.
> This patch does not fix target file for prompt unlike original bpo one : prompt fd is unrelated to tokenizer source which could be read only. It is more of a bugfix regarding the docs : actual documentation say "prompt the user" so one would expect prompt to go on stdout not a file for both PyRun_InteractiveOne\*() and PyRun_InteractiveLoop\*().
Automerge-Triggered-By: GH:pablogsal
(cherry picked from commit 89b13042fc)
Co-authored-by: Paul m. p. P <mail.peny@free.fr>
On Windows, one had to Tab or click on the entry box
to get a cursor and be able to enter anything.
(cherry picked from commit d1df81a730)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
mistakenly included in 3 files in previous PR
and backported both to 3.10 and 3.9.
(cherry picked from commit 916d0d822c)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Disable compiler optimization within test_peg_generator.
This speed up test_peg_generator by always disabling compiler
optimizations by using -O0 or equivalent when the test is building its
own C extensions.
A build not using --with-pydebug in order to speed up test execution
winds up with this test taking a very long time as it would do
repeated compilation of parser C code using the same optimization
flags as CPython was built with.
This speeds the test up 6-8x on gps-raspbian.
Also incorporate's GH-31017's win32 conditional and flags.
Co-authored-by: Kumar Aditya kumaraditya303.
(cherry picked from commit 164a017e13)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 53c7808057)
Co-authored-by: Wes <5124946+wesinator@users.noreply.github.com>
* bpo-46542: test_lib2to3 uses support.infinite_recursion()
Fix a Python crash in test_lib2to3 when using Python built in debug
mode: limit the recursion limit.
The test_all_project_files() test of test_lib2to3 now uses the
test.support.infinite_recursion() context manager when processing the
infinite_recursion.py file to prevent a crash when Python is built in
debug mode.
The two test_all_project_files() tests now use subTest() and log the
refactored/parsed filename (if test_lib2to3 is run in verbose mode).
* Update Lib/lib2to3/tests/data/infinite_recursion.py
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit ee0ac328d3)
Co-authored-by: Victor Stinner <vstinner@python.org>
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>
Less specific number wording (as there is no one right number - the old 100k is too big for some applications and woefully small for others). We now link to NIST SP 800-132 to tell people what to read in there on how to decide for their application.
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
(cherry picked from commit 897ce90187)
Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
In the File menu, 'Close' and 'Exit' are now 'Close Window' (the current
one) and 'Exit' is now 'Exit IDLE' (by closing all windows).
In Shell, 'quit()' and 'exit()' mean 'close Shell'.
If there are no other windows, this also exits IDLE.
(cherry picked from commit fcde0bc10d)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Since,
- Py_CompileString no longer allows to distinguish "incomplete input"
from "invalid input"
- there is no alternative solution available from the Python C API
due to how the new parser works (rewritten in 3.9)
- the only supported way is to manually import the codeop module from C
and use its API as IDLE does, and accept its own complications
it is desirable to remove this Q&A from the official FAQ..
(cherry picked from commit f0a648152f)
Co-authored-by: Mateusz Łoskot <mateusz@loskot.net>
Co-authored-by: Mateusz Łoskot <mateusz@loskot.net>
Fix GCC detection in setup.py when cross-compiling. The C compiler is
now run with LC_ALL=C. Previously, the detection failed with a German
locale.
(cherry picked from commit a9503ac394)
Co-authored-by: Victor Stinner <vstinner@python.org>