The distutils bdist_wininst command is now deprecated, use
bdist_wheel (wheel packages) instead.
(cherry picked from commit 1da4462765)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Fix multiprocessing.util.get_temp_dir() finalizer: clear also the
'tempdir' configuration of the current process, so next call to
get_temp_dir() will create a new temporary directory, rather than
reusing the removed temporary directory.
(cherry picked from commit 9d40554e0d)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
test_distutils.test_build_ext() is now able to remove the temporary
directory on Windows: don't import the newly built C extension ("xx")
in the current process, but test it in a separated process.
(cherry picked from commit 74c9dd5777)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
test_concurrent_futures now cleans up multiprocessing to remove
immediately temporary directories created by
multiprocessing.util.get_temp_dir().
The test now uses setUpModule() and tearDownModule().
(cherry picked from commit 684cb47fff)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
test_winconsoleio doesn't leak a temporary file anymore: use
tempfile.TemporaryFile() to remove it when the test completes.
(cherry picked from commit b71d8d6795)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
ssl.match_hostname() no longer accepts IPv4 addresses with additional text
after the address and only quad-dotted notation without trailing
whitespaces. Some inet_aton() implementations ignore whitespace and all data
after whitespace, e.g. '127.0.0.1 whatever'.
Short notations like '127.1' for '127.0.0.1' were already filtered out.
The bug was initially found by Dominik Czarnota and reported by Paul Kehrer.
Signed-off-by: Christian Heimes <christian@python.org>
https://bugs.python.org/issue37463
(cherry picked from commit 477b1b2576)
Co-authored-by: Christian Heimes <christian@python.org>
multiprocessing tests now call explicitly _run_finalizers() to remove
immediately temporary directories created by
multiprocessing.util.get_temp_dir().
(cherry picked from commit 039fb49c18)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Python initialization now ensures that sys stream encoding
names are always normalized by codecs.lookup(encoding).name.
Simplify test_c_locale_coercion: it doesn't have to normalize
encoding names anymore.
(cherry picked from commit 61bf97e916)
Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
Under some conditions the earlier fix for bpo-18075, "Infinite recursion
tests triggering a segfault on Mac OS X", now causes failures on macOS
when attempting to change stack limit with resource.setrlimit
resource.RLIMIT_STACK, like regrtest does when running the test suite.
The reverted change had specified a non-default stack size when linking
the python executable on macOS. As of macOS 10.14.4, the previous
code causes a hard failure when running tests, although similar
failures had been seen under some conditions under some earlier
systems. Reverting the change to the interpreter stack size at link
time helped for release builds but caused some tests to fail when
built --with-pydebug. Try the opposite approach: continue to build
the interpreter with an increased stack size on macOS and remove
the failing setrlimit call in regrtest initialization. This will
definitely avoid the resource.RLIMIT_STACK error and should have
no, or fewer, side effects.
(cherry picked from commit 5bbbc733e6)
Co-authored-by: Ned Deily <nad@python.org>
Stop using "static PyConfig", PyConfig must now always use
dynamically allocated strings: use PyConfig_SetString(),
PyConfig_SetArgv() and PyConfig_Clear().
(cherry picked from commit 67310023f2)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Fix sys.excepthook() and PyErr_Display() if a filename is a bytes
string. For example, for a SyntaxError exception where the filename
attribute is a bytes string.
Cleanup also test_sys:
* Sort imports.
* Rename numruns global var to INTERN_NUMRUNS.
* Add DisplayHookTest and ExceptHookTest test case classes.
* Don't save/restore sys.stdout and sys.displayhook using
setUp()/tearDown(): do it in each test method.
* Test error case (call hook with no argument) after the success case.
(cherry picked from commit f9b7457bd7)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
bdist_wininst depends on MBCS codec, unavailable on non-Windows,
and bdist_wininst have not worked since at least Python 3.2, possibly
never on Python 3.
Here we document that bdist_wininst is only supported on Windows,
and we mark it unsupported otherwise to skip tests.
Distributors of Python 3 can now safely drop the bdist_wininst .exe files
without the need to skip bdist_wininst related tests.
(cherry picked from commit 72cd653c4e)
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
SSLContext.post_handshake_auth = True no longer sets
SSL_VERIFY_POST_HANDSHAKE verify flag for client connections. Although the
option is documented as ignored for clients, OpenSSL implicitly enables cert
chain validation when the flag is set.
Signed-off-by: Christian Heimes <christian@python.org>
https://bugs.python.org/issue37428
(cherry picked from commit f0f5930ac8)
* Added documentation for textwrap.dedent behavior.
* Remove an obsolete note about pre-2.5 behavior from the docstring.
(cherry picked from commit eb97b9211e)
Co-authored-by: tmblweed <tmblweed@users.noreply.github.com>
sys._base_executable is now always defined on all platforms, and can be overridden through configuration.
Also adds test.support.PythonSymlink to encapsulate platform-specific logic for symlinking sys.executable
Also updates some (unreleased) event names to be consistent with the others.
(cherry picked from commit 44f91c388a)
Co-authored-by: Steve Dower <steve.dower@python.org>
* Fix typo in supports_file2file_sendfile(); ensure that dst is
removed
* Fix test_copytree_custom_copy_function(): remove dst tree.
Use support.rmtree() rather than shutil.rmtree() to remove
temporary directories: support tries harder.
(cherry picked from commit 4c26abd14f)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
* patched string index out of range error in get_word function of _header_value_parser.py and created tests in test__header_value_parser.py for CFWS.
* Raise HeaderParseError instead of continuing when parsing a word.
(cherry picked from commit 7213df7bbf)
Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
Fix test_wsgiref.testEnviron() to no longer depend on the environment
variables (don't fail if "X" variable is set).
testEnviron() now overrides os.environ to get a deterministic
environment. Test full TestHandler.environ content: not only a few
selected variables.
(cherry picked from commit 5150d32792)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
The os.getcwdb() function now uses the UTF-8 encoding on Windows,
rather than the ANSI code page: see PEP 529 for the rationale. The
function is no longer deprecated on Windows.
os.getcwd() and os.getcwdb() now detect integer overflow on memory
allocations. On Unix, these functions properly report MemoryError on
memory allocation failure.
(cherry picked from commit 689830ee62)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Increase robustness of test_resource_tracker(): retry for 60 seconds.
(cherry picked from commit e1a63c4f21)
Co-authored-by: Pierre Glaser <pierreglaser@msn.com>
When certain malformed messages have content-type set to 'mulitpart/*' but
still have a single part body, iter_attachments can raise AttributeError. This
patch fixes it by returning a None value instead when the body is single part.
(cherry picked from commit 02257012f6)
Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
https://bugs.python.org/issue33972
Use os.getgroups() rather than grp.getgrall() to get groups.
Rename also the test to test_chown_gid().
(cherry picked from commit d7c87d982d)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
* The UTF-8 incremental decoders fails now fast if encounter
a sequence that can't be handled by the error handler.
* The UTF-16 incremental decoders with the surrogatepass error
handler decodes now a lone low surrogate with final=False.
(cherry picked from commit 894263ba80)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
eval() was being called an extra time without a filter for
deprecation warnings.
(cherry picked from commit 9fe42b49c7)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* regrtest: Add --cleanup option to remove "test_python_*" directories
of previous failed test jobs.
* Add "make cleantest" to run "python3 -m test --cleanup".
(cherry picked from commit 47fbc4e45b)
… as proposed in PEP 572; key is now evaluated before value.
https://bugs.python.org/issue35224
(cherry picked from commit c8a35417db)
Co-authored-by: Jörn Heissler <joernheissler@users.noreply.github.com>
When the test is ran with `PYTHONWARNINGS=error` the environment variable is passed to the python interpreter used in `assert_python_ok` where `DeprecationWarning` from `@asyncio.coroutine` is converted into an error. Ignore the `DeprecationWarning` in `assert_python_ok`.
https://bugs.python.org/issue37323
(cherry picked from commit 186f70905d)
Co-authored-by: Xtreak <tir.karthi@gmail.com>
test_gdb no longer fails if it gets an "unexpected" message on
stderr: it now ignores stderr. The purpose of test_gdb is to test
that python-gdb.py commands work as expected, not to test gdb.
(cherry picked from commit e56a123fd0)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Tab now moves focus across and down for Help Source and Custom Run.
(cherry picked from commit 54cf2e0780)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
For datetime.datetime.strptime(), the leading zero for some two-digit formats is optional.
This adds a footnote to the strftime/strptime documentation to reflect this fact, and adds some tests to ensure that it is true.
bpo-34903
(cherry picked from commit 6b9c204ee7)
Co-authored-by: Mike Gleen <mike.gleen@gmail.com>
The initialize options are 1) add command line options, which are appended to sys.argv as if passed on a real command line, and 2) skip the shell restart. The customization dialog is accessed by a new entry on the Run menu.
(cherry picked from commit 201bc2d18b)
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
test_pre_initialization_sys_options() of test_embed now removes
PYTHON* environment variables like PYTHONWARNINGS.
(cherry picked from commit dbdc991a62)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Measure required height by quickly maximizing once per screen.
A search for a better method failed.
(cherry picked from commit 5bff3c86ab)
Co-authored-by: Tal Einat <taleinat+github@gmail.com>
bpo-35031, bpo-35998: Reintroduce workaround on Windows and FreeBSD
in test_start_tls_server_1() of test_asyncio: disable TLS v1.3 on the
client context.
(cherry picked from commit c034b7824f)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
On Windows, os.dup() no longer creates an inheritable fd when handling a
character file.
(cherry picked from commit 28fca0c422)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
The patch needed for 2.7 should make the test more stable on 3.x also.
(cherry picked from commit 66d47da86a)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
uuid could try fallback methods that had no chance of working on a particular
platform, and this could cause spurious test failures, as well as degraded
performance as fallback options were tried and failed.
This fixes both the uuid module and its test's SkipUnless logic to use a
prefiltered list of techniques that may at least potentially work on that platform.
Patch by Michael Felt (aixtools).
(cherry picked from commit 3a1d50e7e5)
Co-authored-by: Michael Felt <aixtools@users.noreply.github.com>
bpo-35537, bpo-35876: Fix also test_start_new_session() of
test_subprocess: use os.getsid() rather than os.getpgid().
(cherry picked from commit 5884043252)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Document reference cycle and resurrected objects issues in
sys.unraisablehook() and threading.excepthook() documentation.
Fix test.support.catch_unraisable_exception(): __exit__() no longer
ignores unraisable exceptions.
Fix test_io test_writer_close_error_on_close(): use a second
catch_unraisable_exception() to catch the BufferedWriter unraisable
exception.
(cherry picked from commit 212646cae6)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Join the thread to prevent leaking a running thread and leaking a
reference.
Cleanup also the test:
* asyncioWindowsProactorEventLoopPolicy became the default policy,
there is no need to set it manually.
* Only start the thread once the loop is running.
* Use a shorter sleep in the thread (100 ms rather than 1 sec).
* Use close_loop(loop) rather than loop.close().
* Use longer variable names.
(cherry picked from commit 07559450b2)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Fix a regression introduced by af8646c805 that was causing code of the form:
if True and False:
do_something()
to be optimized incorrectly, eliminating the block.
(cherry picked from commit 05f8318655)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
The peephole optimizer was not optimizing correctly bytecode after negative deltas were introduced. This is due to the fact that some special values (255) were being searched for in both instruction pointer delta and line number deltas.
(cherry picked from commit 3498c642f4)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
The __exit__() method of test.support.catch_unraisable_exception
context manager now ignores unraisable exception raised when clearing
self.unraisable attribute.
(cherry picked from commit 6d22cc8e90)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Allow pure Python implementation of pickle to work
even when the C _pickle module is unavailable.
Fix test_pickle when _pickle is missing: declare PyPicklerHookTests
outside "if has_c_implementation:" block.
(cherry picked from commit 63ab4ba07b)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-36402: Fix threading._shutdown() race condition (GH-13948)
Fix a race condition at Python shutdown when waiting for threads.
Wait until the Python thread state of all non-daemon threads get
deleted (join all non-daemon threads), rather than just wait until
Python threads complete.
* Add threading._shutdown_locks: set of Thread._tstate_lock locks
of non-daemon threads used by _shutdown() to wait until all Python
thread states get deleted. See Thread._set_tstate_lock().
* Add also threading._shutdown_locks_lock to protect access to
threading._shutdown_locks.
* Add test_finalization_shutdown() test.
(cherry picked from commit 468e5fec8a)
* bpo-36402: Fix threading.Thread._stop() (GH-14047)
Remove the _tstate_lock from _shutdown_locks, don't remove None.
(cherry picked from commit 6f75c87375)
* bpo-18748: Fix _pyio.IOBase destructor (closed case) (GH-13952)
_pyio.IOBase destructor now does nothing if getting the closed
attribute fails to better mimick _io.IOBase finalizer.
(cherry picked from commit 4f6f7c5a61)
* bpo-37223: test_io: silence destructor errors (GH-13954)
Implement also MockNonBlockWriterIO.seek() method.
(cherry picked from commit b589cef9c4)
* bpo-37223, test_io: silence last 'Exception ignored in:' (GH-14029)
Use catch_unraisable_exception() to ignore 'Exception ignored in:'
error when the internal BufferedWriter of the BufferedRWPair is
destroyed. The C implementation doesn't give access to the
internal BufferedWriter, so just ignore the warning instead.
(cherry picked from commit 913fa1c824)
Rename compile() feature_version parameter to _feature_version and
convert it to a keyword-only parameter.
Update also test_type_comments to pass feature_version as a tuple.
(cherry picked from commit efdf6ca90f)
because "getaddrinfo()" behaves different on AIX
https://bugs.python.org/issue35545
(cherry picked from commit 32dda263e4)
Co-authored-by: Michael Felt <aixtools@users.noreply.github.com>
Mock the HTTPConnection.close() method in a few unit tests to avoid
logging "Exception ignored in: ..." messages.
(cherry picked from commit eb976e47e2)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
(A single int is still allowed, but undocumented.)
https://bugs.python.org/issue35766
(cherry picked from commit 10b55c1643)
Co-authored-by: Guido van Rossum <guido@python.org>
* [bpo-36520](https://bugs.python.org/issue36520): reset the encoded word offset when starting a new
line during an email header folding operation
* 📜🤖 Added by blurb_it.
* [bpo-36520](https://bugs.python.org/issue36520): add an additional test case, and provide descriptive
comments for the test_folding_with_utf8_encoding_* tests
* [bpo-36520](https://bugs.python.org/issue36520): fix whitespace issue
* [bpo-36520](https://bugs.python.org/issue36520): changes per reviewer request -- remove extraneous
backslashes; add whitespace between terminating quotes and
line-continuation backslashes; use "bpo-" instead of
"issue GH-" in comments
(cherry picked from commit f6713e84af)
Co-authored-by: websurfer5 <49998481+websurfer5@users.noreply.github.com>
https://bugs.python.org/issue36520
If internal tasks weak set is changed by another thread during iteration.
https://bugs.python.org/issue36607
(cherry picked from commit 65aa64fae8)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
If preadv2 is not available, preadv will raise NotImplementedError.
(cherry picked from commit 44867bb937)
Co-authored-by: Benjamin Peterson <benjamin@python.org>
This test "works" if things are run in the right order, so it's better to use @skip than @expectedFailure here.
(cherry picked from commit 910b3fcb01)
Co-authored-by: Benjamin Peterson <benjamin@python.org>