Log "Warning -- ..." test warnings into sys.__stderr__ rather than
sys.stderr, to ensure to display them even if sys.stderr is captured.
test.libregrtest.utils.print_warning() now calls
test.support.print_warning().
(cherry picked from commit d663d34685)
Because some people subclass this class and call undocumented methods, and we don't want to break them.
(cherry picked from commit 39652cd8bd)
Co-authored-by: Anthony Sottile <asottile@umich.edu>
It is possible to use either '-isysroot /some/path' (with a space) or
'-isysroot/some/path' (no space in between). Support both forms in
places where special handling of -isysroot is done, rather than just
the first form.
Co-authored-by: Ned Deily <nad@python.org>
(cherry picked from commit b310700976)
Co-authored-by: Joshua Root <jmr@macports.org>
The item size must be checked after encoding to bytes, not before.
Automerge-Triggered-By: @pitrou.
(cherry picked from commit eba9f6155d)
Co-authored-by: Antoine Pitrou <antoine@python.org>
* bpo-39667: Sync zipp 3.0 (GH-18540)
* bpo-39667: Improve pathlib.Path compatibility on zipfile.Path and correct performance degradation as found in zipp 3.0
* 📜🤖 Added by blurb_it.
* Update docs for new zipfile.Path.open
* Rely on dict, faster than OrderedDict.
* Syntax edits on docs
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 0aeab5c438)
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* Clarify the change in behavior with a couple of workaround options.
* Restore API compatibility while backporting performance improvements.
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-37531: regrtest now catchs ProcessLookupError (GH-16827)
Fix a warning on a race condition on TestWorkerProcess.kill(): ignore
silently ProcessLookupError rather than logging an useless warning.
(cherry picked from commit a661392f8f)
* bpo-38502: regrtest uses process groups if available (GH-16829)
test.regrtest now uses process groups in the multiprocessing mode
(-jN command line option) if process groups are available: if
os.setsid() and os.killpg() functions are available.
(cherry picked from commit ecb035cd14)
* bpo-37957: Allow regrtest to receive a file with test (and subtests) to ignore (GH-16989)
When building Python in some uncommon platforms there are some known tests that will fail. Right now, the test suite has the ability to ignore entire tests using the -x option and to receive a filter file using the --matchfile filter. The problem with the --matchfile option is that it receives a file with patterns to accept and when you want to ignore a couple of tests and subtests, is too cumbersome to lists ALL tests that are not the ones that you want to accept and he problem with -x is that is not easy to ignore just a subtests that fail and the whole test needs to be ignored.
For these reasons, add a new option to allow to ignore a list of test and subtests for these situations.
(cherry picked from commit e0cd8aa70a)
* regrtest: log timeout at startup (GH-19514)
Reduce also worker timeout.
(cherry picked from commit 4cf65a630a)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Patcher's __exit__() is now never called if its __enter__() is failed.
Returning true from __exit__() silences now the exception.
(cherry picked from commit 4b222c9491)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Only one particular sub-test of
ctypes.test.test_loading.test_load_dll_with_flags is disabled, which
caused failures on Azure Pipelines CI.
(cherry picked from commit f407e209c1)
Co-authored-by: Zachary Ware <zach@python.org>
If fork was not called by a thread spawned by threading.Thread,
threading._after_fork() now creates a _MainThread instance for
_main_thread, instead of a _DummyThread instance.
(cherry picked from commit d8ff44ce4c)
Co-authored-by: Victor Stinner <vstinner@python.org>
Inspect.signature failed on the test case because its isinstance call raised.
(cherry picked from commit 52013e5b6d)
Co-authored-by: Tal Einat <taleinat+github@gmail.com>
test_builtin.PtyTests now registers an handler for SIGHUP signal.
Closing the PTY file descriptor can emit a SIGHUP signal: just ignore
it.
run_child() now also closes the PTY file descriptor before waiting
for the process completition, otherwise the test hangs on AIX.
(cherry picked from commit 7a51a7e19f)
There are two copies of the grammar -- the one used by Python itself as
Grammar/Grammar, and the one used by lib2to3 which has necessarily diverged at
Lib/lib2to3/Grammar.txt because it needs to support older syntax an we want it
to be reasonable stable to avoid requiring fixer rewrites.
This brings suport for syntax like `if x:= foo():` to match what the live
Python grammar does.
This should've been added at the time of the walrus operator itself, but lib2to3 being
independent is often overlooked. So we do consider this a bugfix rather than enhancement.
(cherry picked from commit 3c3aa4516c)
Co-authored-by: Tim Hatch <tim@timhatch.com>
The AbstractBasicAuthHandler class of the urllib.request module uses
an inefficient regular expression which can be exploited by an
attacker to cause a denial of service. Fix the regex to prevent the
catastrophic backtracking. Vulnerability reported by Ben Caller
and Matt Schwager.
AbstractBasicAuthHandler of urllib.request now parses all
WWW-Authenticate HTTP headers and accepts multiple challenges per
header: use the realm of the first Basic challenge.
Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit 0b297d4ff1)
Running `test_socket` or anything that depends on it (like python -m
test.pythoninfo) crashes if IOCTL_VM_SOCKETS_GET_LOCAL_CID does not
exist in the socket module.
Automerge-Triggered-By: @pablogsal
(cherry picked from commit 6eb9619c88)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
test_gdb now skips tests if it detects that gdb failed to read debug
information because the Python binary is optimized.
(cherry picked from commit 7bf069b611)
Co-authored-by: Victor Stinner <vstinner@python.org>
Change 0/1 assignments to 'executing', 'canceled', 'reading', 'endoffile'.
These are not used outside of pyshell. Other bools already use False/True.
Add comment about int needed for Windows call.
Remove self.more, unused in idlelib and code.InteractiveInterpreter.
The latter uses 'more' as a local.
(cherry picked from commit 34a49aa3e4)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This pull request fixes the newline conversion bug originally reported in bpo-1812. When that issue was originally submitted, the open builtin did not default to universal newline mode; now it does, which makes the issue fix simpler, since the only code path that needs to be changed is the one in doctest._load_testfile where the file is loaded from a package whose loader has a get_data method.
(cherry picked from commit e0b8101492)
Co-authored-by: Peter Donis <peterdonis@alum.mit.edu>
* bpo-22490: Remove "__PYVENV_LAUNCHER__" from the shell environment on macOS
This changeset removes the environment varialbe "__PYVENV_LAUNCHER__"
during interpreter launch as it is only needed to communicate between
the stub executable in framework installs and the actual interpreter.
Leaving the environment variable present may lead to misbehaviour when
launching other scripts.
* Actually commit the changes for issue 22490...
* Correct typo
Co-Authored-By: Nicola Soranzo <nicola.soranzo@gmail.com>
* Run make patchcheck
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
(cherry picked from commit 044cf94f61)
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
When the pull is not used via the context manager or terminate() is called, there is a system in multiprocessing.util that handles finalization of all pools via an atexit handler (the Finalize) class. This class registers the _terminate_pool handler in the registry of finalizers of the module, and that registry is called on interpreter exit via _exit_function. The problem is that the "happy" path with the context manager or manual call to finalize() does some extra steps that _terminate_pool does not. The step that is not executed when the atexit() handler calls _terminate_pool is pinging the _change_notifier queue to unblock the maintenance threads.
This commit moves the notification to the _terminate_pool function so is called from both code paths.
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
(cherry picked from commit ac10e0c932)
Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com>
Add host validation for control characters for more CVE-2019-18348 protection.
(cherry picked from commit 9165addc22)
Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
In math_2(), the first PyFloat_AsDouble() call should be checked
for failure before the second call.
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>.
(cherry picked from commit 5208b4b379)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Create call objects with awaited arguments instead of using call_args which has only last call value.
(cherry picked from commit e553f204bf)
Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
- When casting to _Bool, arrays should only contain zeros or ones.
(cherry picked from commit 1ae9cde4b2)
Co-authored-by: Stefan Krah <skrah@bytereef.org>