* test_tempfile.test_no_leak_fd() mocks os.close() but it doesn't
call the original os.close() method and so leaks an open file
descriptor. Fix the test by calling the original os.close()
function.
* test_posix.test_fdopen_directory(): close the directory file
descriptor when the test completes.
* Add support.wait_threads_exit(): context manager looping at exit
until the number of threads decreases to its original number.
* Add some missing thread.join()
* test_asyncore.test_send(): call explicitly t.join() because the cleanup
function is only called outside the test method, whereas the method
has a @test_support.reap_threads decorator
* test_hashlib: replace threading.Event with thread.join()
* test_thread:
* Use wait_threads_exit() context manager
* Replace test_support with support
* test_forkinthread(): check child process exit status in the
main thread to better handle error.
Backport manually regrtest enhancements from master:
* No longer clear filters, like --match, to re-run failed tests in
verbose mode (-w option).
* Tests result: always indicate if tests have been interrupted.
* Enhance tests summary
* After failing tests are re-run, display again the summary.
* Add environment_altered to test.support, but it's currently unused
* regrtest: count also ENV_CHANGED as failures
* regrtest: Enhance format_duration()
* Replace test_support with support
Use also support.SOCK_MAX_SIZE, not only support.PIPE_MAX_SIZE, to
get the size for a blocking send into a multiprocessing pipe.
Replace also test_support with support.
* bpo-31479: Always reset the signal alarm in tests
Use "try: ... finally: signal.signal(0)" pattern to make sure that
tests don't "leak" a pending fatal signal alarm.
* Move two more alarm() calls into the try block
Fix also typo: replace signal.signal(0) with signal.alarm(0)
* Move another signal.alarm() into the try block
(cherry picked from commit 9abee722d4)
Rename Lib/test/bisect.py to Lib/test/bisect_cmd.py. The old name was
in conflict with Lib/bisect.py, causing test failures, depending how
tests were run.
For example, "python2.7 Lib/test/test_httpservers.py" imported
indirectly Lib/test/bisect.py instead of Lib/bisect.py
on "import bisect".
* Add a space to ensurepip's --altinstall option
* Add periods to the arguments of ensurepip that didn't have it
This makes --help for all optional arguments consistent and also makes it
consistent with pip --help..
(cherry picked from commit e9537ad6a1)
Co-authored-by: Wieland Hoffmann <mineo@users.noreply.github.com>
* Fixed a leak when the GC fails to add an object with __del__ into
the gc.garbage list.
* PyGC_Collect() can now be called when an exception is set and
preserves it.
(cherry picked from commit 301e3cc8a5)
uuid._ipconfig_getnode did not validate the maximum length of the value,
so long as the value had the same type of formatting as a MAC address.
This let it select DUIDs as MAC addresses. It now requires an exact
length match..
(cherry picked from commit c66c342cb4)
Co-authored-by: CtrlZvi <viz+github@flippedperspective.com>
The robotparser's __str__ representation now includes wildcard
entries.
(cherry picked from commit c3fa1f2b93)
Co-authored-by: Michael Lazar <lazar.michael22@gmail.com>.
Clarify that flush is implied when the call to write contains a newline character.
(cherry picked from commit 7ffd4c58fa)
Co-authored-by: Elena Oat <oat.elena@gmail.com>