The multiprocessing module now uses the monotonic clock
time.monotonic() instead of the system clock time.time() to implement
timeouts.
(cherry picked from commit c2368cbc83ca2bafeaea0e4760be4996046d0444)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
[3.6] bpo-33899: Make tokenize module mirror end-of-file is end-of-line behavior (GH-7891) (GH-8134)
Most of the change involves fixing up the test suite, which previously made
the assumption that there wouldn't be a new line if the input didn't end in
one.
Result of function interpreter_requires_environment() depends on os.environ.
This was not covered by the tests, leading to fail when PYTHONHOME was set.
(cherry picked from commit a390cb6b6fb6638e91d699513167e8f35b47f846)
Co-authored-by: Lorenz Mende <Lorenz.mende@gmail.com>
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.
(cherry picked from commit 07888e1cce89e9bb7dc501e287b4cb126e01c378)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
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.
(cherry picked from commit 12a08c47601cadea8e7d3808502cdbcca87b2ce2)
bpo-24596: Decref module in PyRun_SimpleFileExFlags() on SystemExit (GH-7918) (GH-8069)
PyErr_Print() will not return when the exception is a SystemExit, so
decref the __main__ module object in that case.
(cherry picked from commit d8cba5d16f1333fd625726fc72e66afbd45b8d00)
bpo-34019: Fix wrong arguments for Opera Browser (GH-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.
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()
(cherry picked from commit 23401fb960bb94e6ea62d2999527968d53d3fc65)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
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.
(cherry picked from commit d824ca7f4df9b5f77cf02490b0e98c2408e21fee)
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
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().
(cherry picked from commit fdb5a50ef34f7951c3b01eb77b1359725a9ad670)
Tal Einat [Sat, 30 Jun 2018 13:15:53 +0000 (16:15 +0300)]
[3.6] bpo-32568: make select.epoll() and its docs consistent (GH-7840) (GH-8025)
* `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()`.
bpo-33974: Fix passing special characters to ttk widgets. (GH-7986)
Fix passing lists and tuples of strings containing special characters
'"', '\\', '{', '}' and '\n' as options to tkinter.ttk widgets.
(cherry picked from commit 5bb5bbfca847524bab5f2368bdb48eedf5dba74f)
bpo-14117: Make minor tweaks to turtledemo (GH-8002)
The 'wikipedia' example is now 'rosette', describing what it draws.
The 'penrose' print output is reduced. The 'tree' '1024'
output is eliminated.
(cherry picked from commit 891a1f86d415779cf67ca23e626a868e586feb05)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* 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.
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.
(cherry picked from commit fbd7172325e6ce55b6d5d3d7603e4c1c8a219cb8)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
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
(cherry picked from commit f15f66d275d1166839312c9ff3a67c00b486c7d6)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
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.
(cherry picked from commit 3c8043d8fac4c0d05c0ba9e4e555e2f3165f2fe0)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
it's better to refer to PEP with `pep` role in reStructuredText. It also links to the PEP page.
(cherry picked from commit df748c20dabcec5a6e89e0dd74fff21110f8755a)
Co-authored-by: Behzad B. Mokhtari <35877268+perplexionist@users.noreply.github.com>
bpo-33951: IDLE test_configdialog: call page.update in setUpClass (GH-7892)
This avoids a failure in at least one case when running only a single
test method rather than all tests in the module.
The issue came up when testing the following on Windows 10 Pro 64-bit:
HighPageTest.test_highlight_target_text_mouse
(cherry picked from commit 2af9f5d334eeca588eeee87d177faf0012c63a03)
Co-authored-by: Tal Einat <taleinat+github@gmail.com>
bpo-33950: Remove IDLE htest spec for a deleted file. (GH-7881)
In configdialog, the custom tabbedpages widget was replaced
by ttk.notebook several months ago.
(cherry picked from commit 5ae70f66ff1949eec35ff207c97cfe572c4e74c8)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
bpo-33924: Change IDLE mainmenu.menudefs key 'windows' to 'window' (GH-7836)
Every other menudef key is the lowercase version of the
corresponding main menu entry (in this case, 'Window').
(cherry picked from commit 33c7420e7dd9d8e5b2aa15e98da6291bab6fcf33)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
bpo-33906: Rename idlelib.windows as window (GH-7833)
Match Window on the main menu and remove last plural module name.
Change imports, test, and attribute references to match new name.
(cherry picked from commit a361e89d5ae3daefe9e8b8a7e889cd2ad8c45b77)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
bpo-33917: Fix and document idlelib/idle_test/template.py (GH-7830)
The revised file compiles, runs, and tests OK. idle_test/README.txt
explains how to use it to create new IDLE test files.
(cherry picked from commit 87a927325e3856621790a39d8718ff24a19510aa)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
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".
bpo-33907: Rename an IDLE module and classes. (GH-7810)
Fix-up class name duplication in PR GH-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.
(cherry picked from commit 9af1836664d241fec6e62955ffaa559b3a2eaf1b)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Terry Jan Reedy [Wed, 20 Jun 2018 04:22:48 +0000 (00:22 -0400)]
[3.6] bpo-33907: Rename an IDLE module and class. (GH-7807) (GH-7809)
Improve consistency and appearance. Module idlelib.calltips is now calltip.
Class idlelib.calltip_w.CallTip is now Calltip.
(cherry picked from commit 06e2029dfa500a42e3565ed7ba8573412f153d1c)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
bpo-33855: Still more edits and minimal tests for IDLE (GH-7784)
Part 3 of 3, continuing PR GH-7689. This covers 14 idlelib modules and their tests,
rpc to zoomheight except for run (already done) and tooltip (being done separately).
(cherry picked from commit 4d92158f4c3917fc4fbfebff15224e74782abf79)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
bpo-33901: Fix test_dbm_gnu for gdbm 1.15 (GH-7798)
Fix test_dbm_gnu.test_reorganize() on macOS with gdbm 1.15: add a
larger value to make sure that the file size changes.
(cherry picked from commit 13c79c677f9ec9437c82eda72fa1c2d288d8fceb)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
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.
(cherry picked from commit 936f03e7fafc28fd6fdfba11d162c776b89c0167)
bpo-33855: More edits and new minimal tests for IDLE (GH-7761)
Part 2 of 3. Continues PR GH-7689, changeset ee5ef30.
Edit and add tests for 18 modules, help_about to replace and run.
(cherry picked from commit ea3dc8029ab6a0f1ee6a8a72f1612dea74892e08)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Terry Jan Reedy [Sat, 16 Jun 2018 16:49:10 +0000 (12:49 -0400)]
[3.6] bpo-33855: Minimally test all IDLE modules. (GH-7689) (GH-7734)
Create a template for minimally testing a tkinter-using module by importing it and instantiating its class(es). Add a test file for all non-startup IDLE modules. Edit existing files and update coverage. This is part 1 of 3, covering the 21 autocomplete to help modules and touching 33 idlelib files..
(cherry picked from commit ee5ef309c7e2daef1248730145408f700732c42e)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
bpo-33861: Minor improvements of tests for os.path. (GH-7715)
* Test exists(), lexists(), isdir(), isfile(), islink(), ismount()
with bytes paths.
* Remove unneeded silencing DeprecationWarning for ismount() with
bytes path.
* Test common functions with unencodable and undecodable paths.
* Minor clean up and refactoring.
(cherry picked from commit 17a0088e2680e12ce2c5f2ffc6b71766299e38d5)
bpo-33852: Remove misplaced parentheses around 'list'. (GH-7672)
'expresson list' refers to the grammar term 'expression_list' in the subscription production.
(cherry picked from commit 4fddd4e4069aad9efad999d8d9ce3cd9fb523a5c)
* bpo-32962: Fix test_gdb failure in debug build with -mcet -fcf-protection -O0 (GH-6754)
When Python is built with the intel control-flow protection flags,
-mcet -fcf-protection, gdb is not able to read the stack without
actually jumping inside the function. This means an extra
'next' command is required to make the $pc (program counter)
enter the function and make the stack of the function exposed to gdb.
Marked files are collapsed by default in Github pull request.
https://github.com/github/linguistGH-generated-code
(cherry picked from commit c1897eda3d47b182977459a1e9fed4b3854a10a0)
bpo-29456: Fix bugs in unicodedata.normalize: u1176, u11a7 and u11c3 (GH-1958)
Hangul composition check boundaries are wrong for the second character
([0x1161, 0x1176) instead of [0x1161, 0x1176]) and third character ((0x11A7, 0x11C3)
instead of [0x11A7, 0x11C3]).
(cherry picked from commit d134809cd3764c6a634eab7bb8995e3e2eff14d5)
bpo-33828: Add missing versionchanged note for string.Formatter. (GH-7668)
string.Formatter auto-numbering feature was added in 3.4 and there
is no versionchanged note in its documentation, making the documentation
ambiguous about which version the feature is available.
(cherry picked from commit b9d8ad5130e0f77be28a3dec6d468e6470835573)
When attempting to base64-decode a payload of invalid length (1 mod 4),
properly recognize and handle it. The given data will be returned as-is,
i.e. not decoded, along with a new defect, InvalidBase64LengthDefect.
(cherry picked from commit c3f55be7dd012b7e92901627d0b31c21e983ccb4)
Co-authored-by: Tal Einat <taleinat+github@gmail.com>