Result of function interpreter_requires_environment() depends on os.environ.
This was not covered by the tests, leading to fail when PYTHONHOME was set.
Fix test_forkserver_sigkill() of test_multiprocessing_forkserver:
give more time to the first child process to complete, double the
sleep in the parent process.
Reduce also the child process sleep from 1000 ms to 500 ms, to not change
the total duration of the test.
During buffered read, use a list followed by join instead of extending a bytes object.
This is how it was done before but changed in commit b506dc32c1a.
Bumsik Kim [Tue, 3 Jul 2018 11:30:06 +0000 (07:30 -0400)]
bpo-34019: Fix wrong arguments for Opera Browser (#8047)
The Opera Browser was using a outdated command line invocation that resulted in an incorrect URL being opened in the browser when requested using the webbrowser module.
* Correct the arguments passed to the Opera Browser when opening a new URL.
Victor Stinner [Tue, 3 Jul 2018 11:20:35 +0000 (13:20 +0200)]
bpo-33735: Fix test_multiprocessing random failure (GH-8059)
When hunting memory leaks using -R 3:3, test_imap_unordered() of
test_multiprocessing leaks randomly a few memory blocks. It is a
false alarm: when testing using -R 3:20 for example, no leak is
detected.
Modify test_imap_unordered() to be closer to test_imap():
* Only test 10 numbers instead of 1000: it's a pool of 4 processes, so
10 is enough to test at least one number per process
* Use chunksize=100 instead of chunksize=53 to mimick test_imap()
Zachary Ware [Mon, 2 Jul 2018 20:31:42 +0000 (15:31 -0500)]
bpo-34006: Revert line length limit for Windows help docs (GH-8051)
The line-length limit is not needed because the pages appear in a separate app rather
than on a browser tab. It can also interact badly with the DPI setting.
Serhiy Storchaka [Sat, 30 Jun 2018 17:57:50 +0000 (20:57 +0300)]
bpo-25862: Fix several bugs in the _io module. (GH-8026)
They can be exposed when some C API calls fail due to lack of
memory.
* Failed Py_BuildValue() could cause an assertion error in the
following TextIOWrapper.tell().
* input_chunk could be decrefed twice in TextIOWrapper.seek()
after failed Py_BuildValue().
* initvalue could leak in StringIO.__getstate__() after failed
PyDict_Copy().
Tal Einat [Sat, 30 Jun 2018 12:43:23 +0000 (15:43 +0300)]
bpo-32568: make select.epoll() and its docs consistent (#7840)
* `flags` is indeed deprecated, but there is a validation on its value for
backwards compatibility reasons. This adds mention of this in the docs.
* The docs say that `sizehint` is deprecated and ignored, but it is still
used when `epoll_create1()` is unavailable. This adds mention of this in
the docs.
* `sizehint=-1` is acceptable again, and is replaced with `FD_SETSIZE-1`.
This is needed to have a default value available at the Python level,
since `FD_SETSIZE` is not exposed to Python. (see: bpo-31938)
* Reject `sizehint=0` since it is invalid to pass on to `epoll_create()`.
* Increase timeout from 10 seconds to 1 minute in
test_source_main_skipped_in_children source of
test_multiprocessing_main_handling.
* Replace time.time() with time.monotonic().
* On timeout, include the duration in the error message.
Victor Stinner [Wed, 27 Jun 2018 16:18:10 +0000 (18:18 +0200)]
bpo-30356: Fix test_mymanager_context() of multiprocessing (GH-7968)
test_mymanager_context() now also accepts -SIGTERM as an expected
exitcode for the manager process. The process is killed with SIGTERM
if it takes longer than 1 second to stop.
Victor Stinner [Wed, 27 Jun 2018 09:40:24 +0000 (11:40 +0200)]
bpo-33929: multiprocessing: fix handle leak on race condition (GH-7921)
Fix a race condition in Popen of
multiprocessing.popen_spawn_win32. The child process now duplicates
the read end of pipe instead of "stealing" it.
Previously, the read end of pipe was "stolen" by the child process,
but it leaked a handle if the child process had been terminated
before it could steal the handle from the parent process.
Tolerate a different of 50 ms, instead of just 30 ms, in
test_timeout() of multiprocessing tests. This change should fix such
test failure on Windows:
FAIL: test_timeout (test.test_multiprocessing_spawn.WithProcessesTestQueue)
Traceback (most recent call last):
File "lib\test\_test_multiprocessing.py", line 753, in test_timeout
self.assertGreaterEqual(delta, 0.170)
AssertionError: 0.16138982772827148 not greater than or equal to 0.17
Terry Jan Reedy [Wed, 27 Jun 2018 04:07:30 +0000 (00:07 -0400)]
bpo-33975: Avoid small type when running IDLE's htests. (GH-7944)
Import pyshell first in htest to call SetProcessDpiAwareness on Windows
before tkinter.Tk() is called for the htest. Apparently, 'root.destroy()'
undoes a previous 'root = Tk()'. Since IDLE unittests always destroy roots,
a unittest before an htest does not require anything more to work right.
Since part of the purpose of human-viewed tests is to determine that
widgets look right, it is important that they look the same for testing
as when running IDLE.
Victor Stinner [Fri, 22 Jun 2018 17:25:44 +0000 (19:25 +0200)]
bpo-33671: Add support.MS_WINDOWS and support.MACOS (GH-7800)
* Add support.MS_WINDOWS: True if Python is running on Microsoft Windows.
* Add support.MACOS: True if Python is running on Apple macOS.
* Replace support.is_android with support.ANDROID
* Replace support.is_jython with support.JYTHON
* Cleanup code to initialize unix_shell
Victor Stinner [Wed, 20 Jun 2018 09:29:33 +0000 (11:29 +0200)]
bpo-33746: Fix test_unittest.testRegisterResult() in verbose mode (GH-7799)
Only make sure that the result is in unittest.signals._results, don't
check the full content of unittest.signals._results.
support._run_suite() uses TextTestRunner in verbose mode, but
TextTestRunner.run() calls registerResult(result) which made the test
fail with "odd object in result set".
Call also removeResult() to restore unittest.signals._results to
avoid test side effect.
Terry Jan Reedy [Wed, 20 Jun 2018 06:18:49 +0000 (02:18 -0400)]
bpo-33907: Rename an IDLE module and classes. (GH-7810)
Fix-up class name duplication in PR #7807. Combined effect is that
module calltips and its class CallTips are now calltip and Calltip.
In module calltip_w class CallTip is now CalltipWindow.
Terry Jan Reedy [Tue, 19 Jun 2018 23:12:52 +0000 (19:12 -0400)]
bpo-33855: Still more edits and minimal tests for IDLE (GH-7784)
Part 3 of 3, continuing PR #7689. This covers 14 idlelib modules and their tests,
rpc to zoomheight except for run (already done) and tooltip (being done separately).
Giampaolo Rodola [Tue, 19 Jun 2018 15:27:29 +0000 (08:27 -0700)]
bpo-33671 / shutil.copyfile: use memoryview() with dynamic size on Windows (#7681)
bpo-33671
* use memoryview() with size == file size on Windows, see https://github.com/python/cpython/pull/7160#discussion_r195405230
* release intermediate (sliced) memoryview immediately
* replace "OSX" occurrences with "macOS"
* add some unittests for copyfileobj()
Marco Strigl [Tue, 19 Jun 2018 13:20:58 +0000 (15:20 +0200)]
bpo-33365: print the header values beside the keys (GH-6611)
with debuglevel=1 only the header keys got printed. With
this change the header values get printed as well and the single
header entries get '\n' as a separator.
Victor Stinner [Tue, 19 Jun 2018 12:19:54 +0000 (14:19 +0200)]
bpo-33901: Fix test_dbm_gnu for gdbm 1.15 (GH-7791)
Using gdbm 1.15, creating a database creates a file of 16 MiB. Adding
a small entry and then modifying the small entry doesn't change the
file size. Modify test_dbm_gnu to be less strict: allow that the file
size doesn't change.