Commit Graph

41652 Commits

Author SHA1 Message Date
Serhiy Storchaka 946a0b69e2 [3.6] bpo-31071: Avoid masking original TypeError in call with * unpacking (GH-2957) (#2991)
when other arguments are passed.
(cherry picked from commit 25e4f77)
2017-08-03 12:14:35 +03:00
Serhiy Storchaka f08b2be441 [3.6] bpo-30978: str.format_map() now passes key lookup exceptions through. (GH-2790) (#2992)
Previously any exception was replaced with a KeyError exception.
(cherry picked from commit 5075416)
2017-08-03 12:14:07 +03:00
INADA Naoki f142e85d22 bpo-31061: fix crash in asyncio speedup module (GH-2984)
(cherry picked from commit de34cbe9cd)
2017-08-02 16:50:39 +09:00
Terry Jan Reedy 48fcc72c83 [3.6] bpo-31083: IDLE: Describe the Page classes in configdialog (GH-2965) (#2973)
Add template as comment. Update existing classes to match outline.
Initial patch by Cheryl Sabella.
(cherry picked from commit 6f446be)
2017-08-01 01:00:33 -04:00
csabella 2bf1586e60 [3.6] bpo-25684: ttk.OptionMenu radiobuttons weren't unique (GH-2276) (#2959)
between instances of OptionMenu.
(cherry picked from commit a568e52733)

* Update Misc/ACKS
2017-07-31 22:10:13 +03:00
Terry Jan Reedy 8c4e5be1df [3.6] bpo-31050: IDLE: Factor GenPage class from ConfigDialog (GH-2952) (#2955)
The slightly modified tests for the General tab continue to pass.
Patch by Cheryl Sabella.
(cherry picked from commit e8eb17b)
2017-07-30 19:02:51 -04:00
Terry Jan Reedy 7582226a92 [3.6] bpo-31004: IDLE: Factor out FontPage class from configdialog (step 1) (GH-2905) (#2950)
The slightly modified tests continue to pass. The General test
broken by the switch to Notebook is fixed.
Patch mostly by Cheryl Sabella.
(cherry picked from commit 9397e2a)
2017-07-30 15:00:50 -04:00
Terry Jan Reedy c9c85321df [3.6] bpo-30928: Update IDLE News.txt. (GH-2948) (#2949)
(cherry picked from commit c3aa47f655)
2017-07-30 13:35:46 -04:00
Terry Jan Reedy b26cc82b22 [3.6] bpo-31027: Fix test_listcomps failure when run directly (GH-2939) (#2945)
Bug appears to be incomplete copy-paste-edit.
(cherry picked from commit ceb93f4)
2017-07-29 14:38:24 -04:00
Terry Jan Reedy 8364feff67 [3.6] bpo-30781: IDLE - Use ttk Notebook in ConfigDialog (GH-2938) (#2944)
The notebook looks a bit better.  It will work better with separate page classes. Traversal of widgets by Tab works better.  Switching tabs with keys becomes possible.  The font sample box works better at large font sizes.

One of the two simulated click tests no longer works.  This will be investigated while fixing a bug with the widget itself.
(cherry picked from commit b331f80)
2017-07-29 01:28:05 -04:00
Terry Jan Reedy ecc80b3f1b [3.6] bpo-30853: IDLE - touch-up configdialog.VarTrace and tests. (GH-2936) (#2937)
Add clear method for tests.  Adjust tests to use global instance.
Remove unneeded ConfigDialog method.
(cherry picked from commit 5d0f30a)
2017-07-28 18:36:30 -04:00
Terry Jan Reedy 02f88d2a41 [3.6] bpo-30853: IDLE: Convert font and general vars to use VarTrace (GH-2914) (#2935)
Instance tracers manages pairs consisting of a tk variable and a
callback function.  When tracing is turned on, setting the variable
calls the function.  Test coverage for the new class is 100%.
(cherry picked from commit 5b59154)
2017-07-28 15:42:43 -04:00
Terry Jan Reedy 2cbb6733bf [3.6] bpo-31060: IDLE: Finish regrouping ConfigDialog methods (GH-2908) (#2925)
Finish resorting the 72 ConfigDialog methods into 7 groups that represent the dialog, action buttons, and font, highlight, keys, general, and extension pages.  This will help with continuing to add tests and improve the pages. It will enable splitting ConfigDialog into 6 or 7 more comprehensible classes.
(cherry picked from commit b166080)
2017-07-27 20:50:39 -04:00
Victor Stinner 54cb3400e5 bpo-31044: Skip test_posix.test_makedev() on FreeBSD (#2915) (#2917)
There is a bug in FreeBSD CURRENT with 64-bit dev_t. Skip the test if
dev_t is larger than 32-bit, until the bug is fixed in FreeBSD
CURRENT.
(cherry picked from commit 12953ffe12)
2017-07-27 18:42:11 +02:00
Victor Stinner d019c7965d bpo-31028: Fix test_pydoc when run directly (#2864) (#2910)
* bpo-31028: Fix test_pydoc when run directly

Fix get_pydoc_link() of test_pydoc to fix "./python
Lib/test/test_pydoc.py": get the absolute path to __file__ to prevent
relative directories.

* Use realpath() instead of abspath()

(cherry picked from commit fd46561167)
2017-07-27 18:05:46 +02:00
Terry Jan Reedy 0c4c65104c [3.6] bpo-31003: IDLE - Add more tests for General tab (GH-2859) (#2906)
* In configdialog: Document causal pathways in create_page_general.
Move related functions to follow this. Simplify some attribute names.
* In test_configdialog: Add tests for load and helplist functions.
Coverage for the general tab is now complete, and 63% overall.
(cherry picked from commit 2bc8f0e)
2017-07-26 21:41:26 -04:00
Terry Jan Reedy 0243bea55d [3.6] bpo-30853: IDLE: Factor a VarTrace class from configdialog.ConfigDialog. (GH-2872) (#2903)
The new class manages pairs of tk Variables and trace callbacks.
It is completely covered by new tests.
(cherry picked from commit 45bf723)
2017-07-26 20:53:13 -04:00
Nir Soffer 25de5baf3e bpo-30980: Fix double close in asyncore.file_wrapper (#2789) (#2898)
* bpo-30980: Fix close test to fail

test_close_twice was not considering the fact that file_wrapper is
duping the file descriptor. Closing the original descriptor left the
duped one open, hiding the fact that close protection is not effective.

* bpo-30980: Fix double close protection

Invalidated self.fd before closing, handling correctly the case when
os.close raises.

* bpo-30980: Fix fd leak introduced in the fixed test
2017-07-27 01:27:08 +02:00
Dong-hee Na 8c2d4cf092 [3.6] bpo-30119: fix ftplib.FTP.putline() to throw an error for a illegal command (#1214) (#2886) 2017-07-26 14:11:25 +02:00
Utkarsh Upadhyay c52cea4954 [3.6] bpo-30822: Fix testing of datetime module. (GH-2530) (GH-2783) (#2816)
* [3.6] bpo-30822: Fix testing of datetime module. (GH-2530) (GH-2783)

Only C implementation was tested.
(cherry picked from commit 287c5594ed)

* [3.6] bpo-30822: Fix testing of datetime module. (GH-2530) (GH-2783)

Only C implementation was tested..
(cherry picked from commit 287c5594ed)
2017-07-26 13:49:16 +02:00
Victor Stinner e42339d3a0 [3.6] bpo-30595: Fix multiprocessing.Queue.get(timeout) (#2027) (#2881)
* bpo-30595: Fix multiprocessing.Queue.get(timeout) (#2027)

multiprocessing.Queue.get() with a timeout now polls its reader in
non-blocking mode if it succeeded to aquire the lock but the acquire
took longer than the timeout.

Co-Authored-By: Grzegorz Grzywacz <grzgrzgrz3@gmail.com>
(cherry picked from commit 1b7863c3b6)

* bpo-30595: Increase test_queue_feeder_donot_stop_onexc() timeout (#2148)

_test_multiprocessing.test_queue_feeder_donot_stop_onexc() now uses a
timeout of 1 second on Queue.get(), instead of 0.1 second, for slow
buildbots.
(cherry picked from commit 8f6eeaf21c)
2017-07-26 05:38:22 +02:00
Victor Stinner a6f045224a bpo-30845: Enhance test_concurrent_futures cleanup (#2564) (#2880)
* bpo-30845: reap_children() now logs warnings

* bpo-30845: Enhance test_concurrent_futures cleanup

In setUp() and tearDown() methods of test_concurrent_futures tests,
make sure that tests don't leak threads nor processes. Clear
explicitly the reference to the executor to make it that it's
destroyed (to prevent "dangling threads" warning).

(cherry picked from commit 3df9dec425)
2017-07-26 05:05:09 +02:00
Victor Stinner d0adfb25c5 [3.6] bpo-26762, bpo-31019: Backport multiprocessing fixes from master to 3.6 (#2879)
* bpo-26762: Avoid daemon process in _test_multiprocessing (#2842)

test_level() of _test_multiprocessing._TestLogging now uses regular
processes rather than daemon processes to prevent zombi processes
(to not "leak" processes).
(cherry picked from commit 06634950c5)

* test_multiprocessing: Fix dangling process/thread (#2850)

bpo-26762: Fix more dangling processes and threads in
test_multiprocessing:

* Queue: call close() followed by join_thread()
* Process: call join() or self.addCleanup(p.join)
(cherry picked from commit d7e64d9934)

* test_multiprocessing detects dangling per test case (#2841)

bpo-26762: test_multiprocessing now detects dangling processes and
threads per test case classes:

* setUpClass()/tearDownClass() of mixin classes now check if
  multiprocessing.process._dangling or threading._dangling was
  modified to detect "dangling" processses and threads.
* ManagerMixin.tearDownClass() now also emits a warning if it still
  has more than one active child process after 5 seconds.
* tearDownModule() now checks for dangling processes and threads
  before sleep 500 ms. And it now only sleeps if there is a least one
  dangling process or thread.
(cherry picked from commit ffb49408f0)

* bpo-26762: test_multiprocessing close more queues (#2855)

* Close explicitly queues to make sure that we don't leave dangling
  threads
* test_queue_in_process(): remove unused queue
* test_access() joins also the process to fix a random warning
(cherry picked from commit b4c52966c8)

* bpo-31019: Fix multiprocessing.Process.is_alive() (#2875)

multiprocessing.Process.is_alive() now removes the process from the
_children set if the process completed.

The change prevents leaking "dangling" processes.
(cherry picked from commit 2db64823c2)
2017-07-26 04:48:56 +02:00
Victor Stinner efe9fcbd2c bpo-31034: Reliable signal handler for test_asyncio (#2867) (#2876)
* bpo-31034: Reliable signal handler for test_asyncio

Don't rely on the current SIGHUP signal handler, make sure that it's
set to the "default" signal handler: SIG_DFL.

* Add comments

(cherry picked from commit 830080913c)
2017-07-26 02:33:47 +02:00
Victor Stinner bb33ccfc5a bpo-30908: Fix dangling thread in test_os.TestSendfile (#2680) (#2844)
tearDown() now clears explicitly the self.server variable to make
sure that the thread is completely cleared when tearDownClass()
checks if all threads have been cleaned up.

Fix the following warning:

$ ./python -m test --fail-env-changed -m test.test_os.TestSendfile.test_keywords -R 3:1 test_os
(...)
Warning -- threading_cleanup() failed to cleanup 0 threads after 3 sec (count: 0, dangling: 2)
(...)
Tests result: ENV CHANGED
(cherry picked from commit d1cc037d14)
2017-07-24 17:40:50 +02:00
Terry Jan Reedy 1daeb25979 [3.6] bpo-30993: IDLE - Improve configdialog font page and tests. (GH-2831) (#2834)
In configdialog: Document causal pathways in create_font_tab docstring.  Simplify some attribute names. Move set_samples calls to var_changed_font (idea from Cheryl Sabella).  Move related functions to positions after the create widgets function.

In test_configdialog: Fix test_font_set so not order dependent.  Fix renamed test_indent_scale so it tests the widget.  Adjust tests for movement of set_samples call.  Add tests for load functions.  Put all font tests in one class and tab indent tests in another.  Except for two lines, these tests completely cover the related functions.
(cherry picked from commit 77e97ca)
2017-07-24 02:50:28 -04:00
Terry Jan Reedy 5aa3bf041d [3.6] bpo-30993: IDLE - Improve configdialog font page and tests. (GH-2818) (#2826)
* Document causal event pathways in docstring.
* Simplify some attribute names.
* Rename test_bold_toggle_set_samples to make test_font_set fail.
* Fix test_font_set so not order dependent.
* Fix renamed test_indent_scale so it tests the widget.
(cherry picked from commit 07ba305)
2017-07-23 14:18:27 -04:00
Gregory P. Smith 8de48fe046 [3.6] Make test_shutil test_disk_usage not depend on the cwd fs (GH-2597) (#2820)
Make test_shutil test_disk_usage not depend on the current working directory's filesystem.
(cherry picked from commit 529746c905)
2017-07-22 23:00:39 -07:00
Terry Jan Reedy 04864b491e [3.6] bpo-30981: IDLE -- Add more configdialog font page tests. (GH-… (#2796)
Verify that clicking the bold checkbutton and calling its command, set_samples, changes the bold setting of both samples. Simplify some names in configdialog.
(cherry picked from commit d0969d6)
(Incorporates changes and fixes from PRs 2798,  7c5798e, and 2810, 616ecf1)

* Fix broken test with PR2798 and PR2810 changes.
2017-07-22 00:56:18 -04:00
Berker Peksag 64b9a15886 [3.6] bpo-29403: Fix mock's broken autospec behavior on method-bound builtin functions (GH-3)
Cython will, in the right circumstances, offer a MethodType instance
where im_func is a builtin function. Any instance of MethodType is
automatically assumed to be a Python-defined function (more
specifically, a function that has an inspectable signature), but
_set_signature was still conservative in its assumptions. As a result
_set_signature would return early with None instead of a mock since
the im_func had no inspectable signature. This causes problems
deeper inside mock, as _set_signature is assumed to _always_
return a mock, and nothing checked its return value.

In similar corner cases, autospec will simply not check the spec of the
function, so _set_signature is amended to now return early with the
original, not-wrapped mock object.

Patch by Aaron Gallagher.

(cherry picked from commit 856cbcc12f)
2017-07-22 01:31:04 +03:00
Victor Stinner bb323b261d bpo-30891: Fix again importlib _find_and_load() (#2665) (#2801)
Use sys.modules.get() in the "with _ModuleLockManager(name):" block
to protect the dictionary key with the module lock and use an atomic
get to prevent race condition.

Remove also _bootstrap._POPULATE since it was unused
(_bootstrap_external now has its own _POPULATE object), add a new
_SENTINEL object instead.
(cherry picked from commit e72b1359f8)
2017-07-21 13:28:55 +02:00
Terry Jan Reedy ac5c1e2ea3 [3.6] bpo-28523: IDLE: Use 'color' instead of 'colour'. (GH-2787) (#2791)
(cherry picked from commit a54a8f1)
2017-07-21 01:29:09 -04:00
Victor Stinner 96ef06f397 bpo-30822: Exclude tzdata from regrtest --all (#2775) (#2777)
When running the test suite using --use=all / -u all, exclude tzdata
since it makes test_datetime too slow (15-20 min on some buildbots)
which then times out on some buildbots.

-u tzdata must now be enabled explicitly, -u tzdata or -u all,tzdata,
to run all test_datetime tests.

Fix also regrtest command line parser to allow passing -u
extralargefile to run test_zipfile64.

Travis CI: remove -tzdata. Replace -u all,-tzdata,-cpu with -u all,-cpu since tzdata is now excluded from -u all.
(cherry picked from commit 5b392bbaeb)
2017-07-20 17:08:48 +02:00
terryjreedy 65c24c8467 [3.6] bpo-30917: IDLE: Add config.IdleConf unittests (GH-2691) (#2753)
Patch by Louie Lu.
(cherry picked from commit f776eb0)
(includes diffs of  ed014f7 and 9f9192a)
* fix config reset from pr 2754

* Fix test_get_font (from pr 2769)
2017-07-20 01:23:00 -04:00
Ammar Askar ae4dca7701 [3.6] bpo-30883: Use pythontest.net instead of debian.org in test_urllib2net (GH-2755) 2017-07-20 03:21:09 +03:00
Serhiy Storchaka a819e5e1e6 [3.6] bpo-30936: Fix a reference leak in json when fail to sort keys. (GH-2712). (#2727)
(cherry picked from commit 49f6449ef4)
2017-07-16 07:48:08 +03:00
Serhiy Storchaka 28343e3392 [3.6] bpo-30876: Relative import from unloaded package now reimports the package (GH-2639) (#2676)
instead of failing with SystemError.

Relative import from non-package now fails with ImportError rather than
SystemError.
(cherry picked from commit 8a9cd20edc)
2017-07-16 07:44:25 +03:00
terryjreedy 65de1f3672 [3.6] bpo-30934: Document coverage details for idlelib tests (GH-2711) (#2726)
* Add section to idlelib/idle-test/README.txt.
* Include check that branches are taken both ways.
* Exclude IDLE-specific code that does not run during unit tests.
(cherry picked from commit 95bebb7)
2017-07-16 00:39:59 -04:00
terryjreedy 1aafd9c8bd [3.6] Update idlelib/NEWS.txt. (GH-2703) (#2704)
(cherry picked from commit 0d0a32f)
2017-07-14 00:29:05 -04:00
terryjreedy 9a09c667cf [3.6] bpo-30913: IDLE: Document tk vars, attributes, and methods for ConfigDialog (GH-2697) (#2702)
The will help writing dialog improvements and splitting the class into multiple classes.
Original patch by Cheryl Sabella.
(cherry picked from commit 36329a4)
2017-07-13 23:53:30 -04:00
terryjreedy 42abf7f973 [3.6] bpo-30870: IDLE: Add configdialog fontlist selection unittest (GH-2666) (#2701)
Initial patch by Louie Lu.
(cherry picked from commit 9b622fb)
2017-07-13 22:24:55 -04:00
Serhiy Storchaka 7d0a995820 [3.6] bpo-30911: Add tests for bad boolean arguments for accelerated json (GH-2690) (#2692)
encoder and decoder.
(cherry picked from commit d3aaa2f)
2017-07-13 11:40:25 +03:00
terryjreedy a9bf62cadf [3.6] bpo-30899: Add unittests, 100% coverage, for IDLE's two ConfigParser subclasses. (GH-2662) (#2685)
Patch by Louie Lu.
(cherry picked from commit 50c9435)
2017-07-12 14:42:37 -04:00
terryjreedy c0179483f1 [3.6] bpo-30779: IDLE: fix changes.delete_section calls in configdialog (GH-2667) (#2674)
Also improve test of config.ConfigChanges.delete_section.
Original patch by Cheryl Sabella.
(cherry picked from commit 6d13b22)
2017-07-11 19:50:10 -04:00
terryjreedy 675c1adfe5 [3.6] bpo-30881: IDLE: add docstrings to browser.py (GH-2638) (#2663)
Patch by Cheryl Sabella.
(cherry picked from commit ba35227)
2017-07-11 02:53:32 -04:00
terryjreedy 953e527763 [3.6] bpo-30870: IDLE -- fix logic error in eae2537. (GH-2660) (#2661)
(cherry picked from commit 5b62b35)
2017-07-11 02:16:41 -04:00
Serhiy Storchaka ecfe4f678b [3.6] bpo-30879: os.listdir() and os.scandir() now emit bytes names when (GH-2634) (#2656)
called with bytes-like argument..
(cherry picked from commit 1180e5a518)
2017-07-11 07:16:11 +03:00
Victor Stinner fe6e686c27 bpo-30891: Fix importlib _find_and_load() race condition (#2646) (#2651)
* Rewrite importlib _get_module_lock(): it is now responsible to hold
  the imp lock directly.
* _find_and_load() now holds the module lock to check if name is in
  sys.modules to prevent a race condition
(cherry picked from commit 4f9a446f3f)
2017-07-10 23:16:27 +02:00
terryjreedy 8e3f73e549 [3.6] bpo-30851: IDLE: Remove unused tk variables in configdialog. (GH-2626) (#2648)
One is a duplicate, one is set but cannot be altered by users.
Patch by Cheryl Sabella.
(cherry picked from commit aa8d0a2)
2017-07-10 15:11:45 -04:00
Victor Stinner 7f3d65d6e4 bpo-30886: Fix multiprocessing.Queue.join_thread() (#2642) (#2643)
multiprocessing.Queue.join_thread() now waits until the thread
completes, even if the thread was started by the same process which
created the queue.

Fix the following warning which occurs randomly when running
test_handle_called_with_mp_queue of test_logging.QueueListenerTest:

Warning -- threading_cleanup() failed to cleanup -1 threads after 4 sec (count: 0, dangling: 1)
(cherry picked from commit 3b69d911c5)
2017-07-10 13:43:20 +02:00
terryjreedy 7ab3342333 [3.6] bpo-30870: IDLE: Change sample font when select by key-up/down (GH-2617) (#2640)
Patch by Louie Lu.
(cherry picked from commit bb2bae8)
2017-07-09 19:26:32 -04:00
Nir Soffer 04f77d4677 [3.6] bpo-29854: Fix segfault in call_readline() (GH-728)
If history-length is set in .inputrc, and the history file is double the
history size (or more), history_get(N) returns NULL, and python
segfaults. Fix that by checking for NULL return value.

It seems that the root cause is incorrect handling of bigger history in
readline, but Python should not segfault even if readline returns
unexpected value.

This issue affects only GNU readline. When using libedit emulation
system history size option does not work.
2017-07-08 21:51:21 +03:00
terryjreedy 552f26680d [3.6] bpo-8231: Call idlelib.IdleConf.GetUserCfgDir only once. (GH-2629) (#2631)
(cherry picked from commit 223c7e7)
2017-07-07 22:47:37 -04:00
terryjreedy edc034221f [3.6] bpo-30779: IDLE -- Factor ConfigChanges class from configdialog, put in config; test. (GH-2612) (#2625)
* In config, put dump test code in a function; run it and unittest in 'if __name__ == '__main__'.
* Add class config.ConfigChanges based on changes_class_v4.py on bpo issue.
* Add class test_config.ChangesTest, partly based on configdialog_tests_v1.py on bpo issue.
* Revise configdialog to use ConfigChanges, mostly as specified in tracker msg297804.
* Revise test_configdialog to match configdialog changes.  All tests pass in both files.
* Remove configdialog functions unused or moved to ConfigChanges.
Cheryl Sabella contributed parts of the patch.
(cherry picked from commit 349abd9)
2017-07-07 16:37:39 -04:00
terryjreedy df0f993298 [3.6] bpo-30780: Fix error in idlelib.test_idle.test_configdialog (GH-2606) (#2613)
(cherry picked from commit 25a4206)
2017-07-06 23:16:31 -04:00
Joel Hillacre c60d2f5e86 bpo-30532: Fix whitespace folding in certain cases (#2591)
Leading whitespace was incorrectly dropped during folding of certain lines in the _header_value_parser's folding algorithm.  This makes the whitespace handling code consistent.
2017-07-06 17:28:22 -04:00
terryjreedy d012648129 [3.6] Update idlelib/NEWS.txt with merges upto 2017 Jul 5. (GH-2595) (#2596)
(cherry picked from commit 1ccbad9c95)
2017-07-06 15:29:35 -04:00
Serhiy Storchaka 03b0e8374b [3.6] bpo-30814: Fixed a race condition when import a submodule from a package. (GH-2580). (#2598)
(cherry picked from commit b4baacee1a)
2017-07-06 08:38:24 +03:00
Yury Selivanov aaa4f99151 [3.6] bpo-30828: Fix out of bounds write in `asyncio.CFuture.remove_done_callback() (GH-2569) (#2590)
(cherry picked from commit 833a3b0d37)
2017-07-05 14:03:10 -04:00
terryjreedy 1278d29000 [3.6] bpo-21624: IDLE -- minor htest fixes (GH-2575) (#2578)
(cherry picked from commit 2000150)
2017-07-05 00:55:29 -04:00
terryjreedy e5bb112ba2 [3.6] bpo-30777: IDLE: configdialog - add docstrings and improve comments (GH-2440) (#2577)
Patch by Cheryl Sabella.
(cherry picked from commit 7eb5883)
2017-07-05 00:54:55 -04:00
Serhiy Storchaka bebd2cfa5f [3.6] bpo-30441: Fix bug when modifying os.environ while iterating over it (GH-2409). (#2556)
(cherry picked from commit 8a8d28501f)
2017-07-04 07:55:32 +03:00
Victor Stinner 4132adb4b8 bpo-30764: Fix regrtest --fail-env-changed --forever (#2536) (#2539)
--forever now stops if a fail changes the environment.
(cherry picked from commit 5e87592fd1)
2017-07-03 12:50:36 +02:00
Nick Coghlan bfdc6fdc0e [3.6] bpo-30597: Show expected input in custom 'print' error message. (GH-2531)
(cherry picked from commit 3a7f03584a)
2017-07-03 17:49:50 +10:00
Antoine Pitrou 3024c05290 [3.6] bpo-30703: Improve signal delivery (GH-2415) (#2527)
* [3.6] bpo-30703: Improve signal delivery (GH-2415)

* Improve signal delivery

Avoid using Py_AddPendingCall from signal handler, to avoid calling signal-unsafe functions.

* Remove unused function

* Improve comments

* Add stress test

* Adapt for --without-threads

* Add second stress test

* Add NEWS blurb

* Address comments @haypo.
(cherry picked from commit c08177a1cc)

* bpo-30796: Fix failures in signal delivery stress test (#2488)

* bpo-30796: Fix failures in signal delivery stress test

setitimer() can have a poor minimum resolution on some machines,
this would make the test reach its deadline (and a stray signal
could then kill a subsequent test).

* Make sure to clear the itimer after the test
2017-07-01 19:12:05 +02:00
Mariatta 48290c1c30 [3.6] Fix trivial typo in json module docstring (GH-2274) (#2430)
(cherry picked from commit 76c567ee27)
2017-06-30 21:15:18 -04:00
Victor Stinner a3ca94d050 [3.6] bpo-29512, bpo-30776: Backport regrtest enhancements from master to 3.6 (#2513)
* bpo-29512: Add test.bisect, bisect failing tests (#2452)

Add a new "python3 -m test.bisect" tool to bisect failing tests.

It can be used to find which test method(s) leak references, leak
files, etc.
(cherry picked from commit 84d9d14a1f)

* bpo-30776: regrtest: reduce memleak false positive (#2484)

Only report a leak if each run leaks at least one memory block.
(cherry picked from commit beeca6e1e5)
2017-06-30 17:31:16 +02:00
Victor Stinner 23caf8cfc6 bpo-30280: Cleanup threads in ayncio tests (#2501) (#2511)
* bpo-30280: asyncio now cleans up threads

asyncio base TestCase now uses threading_setup() and
threading_cleanup() of test.support to cleanup threads.

* asyncio: Fix TestBaseSelectorEventLoop cleanup

bpo-30280: TestBaseSelectorEventLoop of
test.test_asyncio.test_selector_events now correctly closes the event
loop: cleanup its executor to not leak threads.

Don't override the close() method of the event loop, only override
the_close_self_pipe() method.

(cherry picked from commit b903067462)
2017-06-30 17:20:33 +02:00
Victor Stinner 22d4e8fb99 bpo-30813: Fix unittest when hunting refleaks (#2502) (#2505)
bpo-11798, bpo-16662, bpo-16935, bpo-30813: Skip
test_discover_with_module_that_raises_SkipTest_on_import() and
test_discover_with_init_module_that_raises_SkipTest_on_import() of
test_unittest when hunting reference leaks using regrtest.
(cherry picked from commit e4f9a2d2be)
2017-06-30 13:12:20 +02:00
Victor Stinner d0aac5da59 bpo-30812: Fix test_warnings, restore _showwarnmsg (#2504) (#2507)
bpo-26568, bpo-30812: Fix test_showwarnmsg_missing(): restore the
attribute after removing it.
(cherry picked from commit 7eebeb8fb8)
2017-06-30 13:12:12 +02:00
Antoine Pitrou 6f3cb059fd [3.6] bpo-30807: signal.setitimer() may disable the timer by mistake (GH-2493) (#2497)
* bpo-30807: signal.setitimer() may disable the timer by mistake

* Add NEWS blurb
(cherry picked from commit 729780a810)
2017-06-30 10:54:24 +02:00
terryjreedy 6f31717c47 [3.6] bpo-30495: IDLE: improve textview with docstrings, PEP8 names, more tests. (GH-2283) (#2496)
Split TextViewer class into ViewWindow, ViewFrame, and TextFrame classes so that instances
of the latter two can be placed with other widgets within a multiframe window.
Patch by Cheryl Sabella.
(cherry picked from commit 42bc8be)
2017-06-29 19:15:18 -04:00
Antoine Pitrou 38d6a40898 [3.6] Clear potential ref cycle between Process and Process target (GH-2470) (#2471)
* Clear potential ref cycle between Process and Process target

Besides Process.join() not being called, this was an indirect cause of bpo-30775.
The threading module already does this.

* Add issue reference.
(cherry picked from commit 79d37ae979)
2017-06-28 13:08:20 +02:00
Antoine Pitrou e022aad73a [3.6] bpo-30775: Fix refleaks in test_multiprocessing (GH-2467) (#2468)
Forgetting to call Process.join() can keep some resources alive.
(cherry picked from commit a79f8faccf)
2017-06-28 11:49:38 +02:00
Serhiy Storchaka 0834905d9b [3.6] bpo-13617: Reject embedded null characters in wchar* strings. (GH-2302) (#2462)
Based on patch by Victor Stinner.

Add private C API function _PyUnicode_AsUnicode() which is similar to
PyUnicode_AsUnicode(), but checks for null characters..
(cherry picked from commit f7eae0adfc)
2017-06-28 09:27:35 +03:00
terryjreedy 413c0a92bc [3.6] bpo-24813: IDLE tagline is Integrated Development and Learning Environment (GH-2451) (#2461)
Patch by Mark Roseman
(cherry picked from commit 592eda1)
2017-06-27 23:02:38 -04:00
terryjreedy af68382f68 [3.6] bpo-30723: IDLE -- Enhance parenmatch; add style, flash, and help (GH-2306) (#2460)
* Add 'parens' style to highlight both opener and closer.
* Make 'default' style, which is not default, a synonym for 'opener'.
* Make time-delay work the same with all styles.
* Add help for config dialog extensions tab, including parenmatch.
* Add new tests.
Original patch by Charles Wohlganger.
(cherry picked from commit fae2c35)
2017-06-27 23:02:19 -04:00
Serhiy Storchaka 0edffa3073 [3.6] bpo-30708: Check for null characters in PyUnicode_AsWideCharString(). (GH-2285) (#2443)
Raise a ValueError if the second argument is NULL and the wchar_t\*
string contains null characters..
(cherry picked from commit e613e6add5)
2017-06-27 21:08:58 +03:00
Victor Stinner 35d2ca2b94 [3.6] bpo-30523, bpo-30764, bpo-30776: Sync regrtest from master (#2441)
* bpo-30523: regrtest --list-cases --match (#2401)

* regrtest --list-cases now supports --match and --match-file options.
  Example: ./python -m test --list-cases -m FileTests test_os
* --list-cases now also sets support.verbose to False to prevent
  messages to stdout when loading test modules.
* Add support._match_test() private function.
(cherry picked from commit ace56d5836)

* bpo-30764: regrtest: add --fail-env-changed option (#2402)

* bpo-30764: regrtest: change exit code on failure

* Exit code 2 if failed tests ("bad")
* Exit code 3 if interrupted

* bpo-30764: regrtest: add --fail-env-changed option

If the option is set, mark a test as failed if it alters the
environment, for example if it creates a file without removing it.

(cherry picked from commit 63f54c6893)

* bpo-30776: reduce regrtest -R false positives (#2422)

* Change the regrtest --huntrleaks checker to decide if a test file
  leaks or not. Require that each run leaks at least 1 reference.
* Warmup runs are now completely ignored: ignored in the checker test
  and not used anymore to compute the sum.
* Add an unit test for a reference leak.

Example of reference differences previously considered a failure
(leak) and now considered as success (success, no leak):

    [3, 0, 0]
    [0, 1, 0]
    [8, -8, 1]
(cherry picked from commit 48b5c422ff)
2017-06-27 16:04:15 +02:00
terryjreedy 39e501a291 [3.6] bpo-30674: IDLE: add docstrings to grep.py (GH-2213) (#2434)
Patch by Cheryl Sabella
(cherry picked from commit 65474b9)
2017-06-27 03:01:58 -04:00
terryjreedy 93b88e9953 [3.6] bpo-21519: IDLE basic custom key entry better detects duplicates. (GH-2428) (#2433)
Original patch by Saimadhav Heblikar.
(cherry picked from commit 44913e5)
2017-06-27 01:58:18 -04:00
terryjreedy 8bdc3bd3d6 [3.6] bpo-29910: IDLE no longer deletes a character after commenting out a region (GH-825) (#2429)
This happened because shortcut has a class binding and 'break' was not returned.
Fix other potential conflicts between IDLE and default key bindings.

* Add news item

* Update NEWS
(cherry picked from commit 213ce12)
2017-06-27 01:53:40 -04:00
terryjreedy 8047f02a4b [3.6] bpo-24813: IDLE: Add build bitness to About Idle title (GH-2380) (#2426)
Patch by Cheryl Sabella.
(cherry picked from commit 9a02ae3)
2017-06-26 23:09:45 -04:00
terryjreedy 938e73809d [3.6] bpo-30728: IDLE: Refactor configdialog to PEP8 names (GH-2307) (#2421)
Also, change '*' in the tkinter import to an explicit list of names.
Patch by Cheryl Sabella.
(cherry picked from commit bac7d33)
2017-06-26 20:48:39 -04:00
Victor Stinner 9ad50d9459 bpo-30764: test_subprocess uses SuppressCrashReport (#2405) (#2410)
bpo-30764, bpo-29335: test_child_terminated_in_stopped_state() of
test_subprocess now uses support.SuppressCrashReport() to prevent the
creation of a core dump on FreeBSD.
(cherry picked from commit cdee3f14f7)
2017-06-27 00:00:33 +02:00
terryjreedy 64a0c266e7 [3.6] bpo-6739: IDLE: Check for valid keybinding in config_keys (GH-2377) (#2397)
Verify user-entered key sequences by trying to bind them with tk.
Add tests for all 3 validation functions.
Original patch by G Polo.  Tests added by Cheryl Sabella.
(cherry picked from commit 8c78aa7)
2017-06-26 01:21:02 -04:00
Serhiy Storchaka 9c2dc0c58a [3.6] bpo-30746: Prohibited the '=' character in environment variable names (GH-2382) (#2391)
in `os.putenv()` and `os.spawn*()`..
(cherry picked from commit 77703942c5)
2017-06-25 09:49:15 +03:00
Dong-hee Na 504b95047a [3.6] bpo-30616: Functional API of enum allows to create empty enums. (#2304) (#2324) 2017-06-24 09:12:20 -07:00
Mariatta 20f1029584 [3.6] Fix a typo in a comment in coroutines.py (GH-2267) (GH-2370)
defiend -> defined
(cherry picked from commit cab469245d)
2017-06-23 22:44:57 -07:00
terryjreedy bd570f4211 [3.6] bpo-24813: IDLE: Add default title to help_about (GH-2366) (#2369)
Patch by Cheryl Sabella.
(cherry picked from commit 18ede06)
2017-06-23 20:19:46 -04:00
Brett Cannon 9db3ae045d [3.6] bpo-30645: don't append to an inner loop path in imp.load_package() (GH-2268) (#2364)
Bug didn't manifest itself when importing a module with source as .py files are always the first on the search path. The issue only showed up in bytecode-only packages where the calculated file path would be ``__init__.py/__init__.pyc``.

Patch by Alexandru Ardelean.

(cherry picked from commit c38e32a100)
2017-06-23 11:23:36 -07:00
Serhiy Storchaka e7135751b8 [3.6] bpo-30730: Prevent environment variables injection in subprocess on Windows. (GH-2325) (#2360)
Prevent passing other invalid environment variables and command arguments..
(cherry picked from commit d174d24a5d)
2017-06-23 20:17:38 +03:00
terryjreedy 1b7474dedc [3.6] bpo-24813: IDLE: Add icon to help_about (GH-2335) (#2359)
Patch by Cheryl Sabella
(cherry picked from commit d352d68)
2017-06-23 12:59:59 -04:00
Victor Stinner cea2174ab7 bpo-30604: Skip CoExtra tests if ctypes is missing (#2356) (#2358)
(cherry picked from commit a4b091e135)
2017-06-23 15:24:28 +02:00
Serhiy Storchaka c1d5345679 [3.6] bpo-30727: Fix a race condition in test_threading. (GH-2334) (#2351)
(cherry picked from commit 32cb968)
2017-06-23 13:52:06 +03:00
terryjreedy 396998e0c6 [3.6] Fix typo in idlelib.config_key.py (GH-2322) (#2323)
(cherry picked from commit a0e911b)
2017-06-21 22:46:07 -04:00
terryjreedy 296dc492cc [3.6] Fix trivial typo in idlelib/config.py (GH-2309) (#2321)
Comceptually -> Conceptually
(cherry picked from commit f3e8209)
2017-06-21 21:43:47 -04:00
Serhiy Storchaka a1115e1a04 [3.6] bpo-29755: Fixed the lgettext() family of functions in the gettext module. (GH-2266) (#2297)
They now always return bytes.

Updated the gettext documentation..
(cherry picked from commit 26cb4657bc)
2017-06-20 18:06:35 +03:00
Victor Stinner 536c1f1246 bpo-30500: urllib: Simplify splithost by calling into urlparse. (#1849) (#2289)
The current regex based splitting produces a wrong result. For example::

  http://abc#@def

Web browsers parse that URL as ``http://abc/#@def``, that is, the host
is ``abc``, the path is ``/``, and the fragment is ``#@def``.
(cherry picked from commit 90e01e50ef)
2017-06-20 15:37:24 +02:00
Victor Stinner acdf159b24 bpo-29887: test_normalization handles PermissionError (#1196) (#2275)
Skip test_normalization.test_main() if download raises a permission
error.
(cherry picked from commit d13d54748d)
2017-06-19 15:42:43 +02:00
Mariatta 51f40a81a4 [3.6] bpo-29887: Test normalization now fails if download fails (GH-905) (#2271)
* test_normalization fails if download fails

bpo-29887. The test is still skipped if "-u urlfetch" option is not
passed to regrtest (python3 -m test -u urlfetch test_normalization).

* Fix ResourceWarning in test_normalization

bpo-29887: Fix ResourceWarning in test_normalization if tests are
interrupted by CTRL+c.
(cherry picked from commit 722a3af092)
2017-06-19 13:22:54 +02:00
Ned Deily 8c5483eb22 Update pydoc topics for v3.6.2rc1 2017-06-17 04:37:19 -04:00
Mariatta e9f4d8db5f [email] bpo-29478: Fix passing max_line_length=None from Compat32 policy (GH-595) (GH-2233)
If max_line_length=None is specified while using the Compat32 policy,
it is no longer ignored..
(cherry picked from commit b459f74826)
2017-06-16 07:18:58 -07:00
Serhiy Storchaka 2eca5b465f [3.6] bpo-30682: Removed a too-strict assertion that failed for certain f-strings. (GH-2232) (#2242)
This caused a segfault on eval("f'\\\n'") and eval("f'\\\r'") in debug build..
(cherry picked from commit 11e97f2f80)
2017-06-16 09:29:42 -04:00
Victor Stinner a0ccc54e6d Synchronize libregrtest from master to 3.6 (#2244)
* bpo-30523: regrtest: Add --list-cases option (#2238)
* bpo-30284: Fix regrtest for out of tree build (#1481)
* bpo-30540: regrtest: add --matchfile option (#1909)
* bpo-30258: regrtest: Fix run_tests_multiprocess() (#1479)
* bpo-30263: regrtest: log system load (#1452)
2017-06-16 14:39:09 +02:00
terryjreedy 0a4bcf18a7 [3.6]Add IDLE items to NEWS and idlelib/NEWS.txt (#2239) (#2240) 2017-06-16 02:11:31 -04:00
Mariatta 292b421d48 bpo-28837: Fix lib2to3 handling of map/zip/filter calls when followed with a 'trailer', e.g. zip()[x] (GH-24) (GH-2235)
(cherry picked from commit 93b4b47e3a)
2017-06-15 19:56:52 -07:00
Victor Stinner 50dbf577e1 bpo-23890: Fix ref cycle in TestCase.assertRaises (#858)
unittest.TestCase.assertRaises() now manually breaks a
reference cycle to not keep objects alive longer than expected.
(cherry picked from commit bbd3cf8f1e)
2017-06-16 00:18:15 +02:00
Dong-hee Na e45ea377b8 bpo-30149: Fix partialmethod without explicit self parameter (#1308) (#1662) 2017-06-15 17:41:57 +03:00
Serhiy Storchaka cf58dfb44c [3.6] bpo-29931 fix __lt__ check in ipaddress.ip_interface for both v4 and v6. (GH-879) (#2217)
the original logic was just comparing the network address
but this is wrong because if the network address is equal then
we need to compare the ip address for breaking the tie

add more ip_interface comparison tests.
(cherry picked from commit 7bd8d3e794)
2017-06-15 17:16:38 +03:00
Serhiy Storchaka 523a243840 [3.6] bpo-30605: Fix compiling binary regexs with BytesWarnings enabled. (GH-2016) (#2214)
Running our unit tests with `-bb` enabled triggered this failure..
(cherry picked from commit 171b9a354e)
2017-06-15 16:55:22 +03:00
Victor Stinner 8a39af9457 bpo-30231: Remove skipped test_imaplib tests (#1419) (#2192)
The public cyrus.andrew.cmu.edu IMAP server (port 993) doesn't accept
TLS connection using our self-signed x509 certificate. Remove the two
tests which are already skipped.

Write a new test_certfile_arg_warn() unit test for the certfile
deprecation warning.
(cherry picked from commit b18563da88)
2017-06-14 22:43:01 +02:00
terryjreedy 6628006941 [3.6]bpo-15786: Fix IDLE autocomplete return problem. (#2198) (#2199)
Before,  Enter would not, for instance, complete 're.c' to 're.compile' even with 'compile' highlighted.  Now it does.  Before, '\n' was inserted into text, which in Shell meant compile() and possibly execute.  Now cursor is left after completion.
(cherry picked from commit 32fd874afe)
2017-06-14 16:10:10 -04:00
terryjreedy 3280579450 bpo-15786: IDLE: Fix mouse clicks on autocompletetion window (#1811) (#2187)
Patch by Louie Lu.
(cherry picked from commit 778b484145)
2017-06-14 11:43:49 -04:00
Victor Stinner c2a506e40e [3.6] bpo-30649: test_os tolerates 50 ms delta for utime (#2156) (#2175)
* bpo-30649: test_os tolerates 50 ms delta for utime (#2156)

On Windows, tolerate a delta of 50 ms instead of 20 ms in
test_utime_current() and test_utime_current_old() of test_os.

On other platforms, reduce the delta from 20 ms to 10 ms.
(cherry picked from commit c94caca65c)

* bpo-30649: Revert utime delta in test_os (#2176)

PPC64 Fedora 3.x buildbot requires at least a delta of 14 ms: revert
the utime delta to 20 ms.

I tried 10 ms, but test_os failed on the PPC64 Fedora 3.x buildbot.
(cherry picked from commit 3402f72688)
2017-06-14 14:26:52 +02:00
terryjreedy 22d909f8c2 [3.6]bpo-25514: Improve IDLE's connection refused message (#2177) (#2178)
When IDLE fail to start because the socket connection fails, direct people to a new subsection of the IDLE doc listing various causes and remedies.
(cherry picked from commit 188aedf8bb)
2017-06-13 22:13:15 -04:00
terryjreedy d92ee3ea62 [3.6]bpo-27922: Stop gui flash from idle_test.test_parenmatch (#2171) (#2172)
For unknown reasons, this does not work when running leak tests.
(cherry picked from commit 049cf2bb44)
2017-06-13 15:40:59 -04:00
terryjreedy b0efd493b6 [3.6]bpo-30642: Fix ref leak in idle_test.test_macosx (#2163) (#2165)
(cherry picked from commit 8323189ff1)
2017-06-13 11:52:08 -04:00
Antoine Pitrou 6fd0345995 [3.6] bpo-24484: Avoid race condition in multiprocessing cleanup (GH-2159) (#2166)
* bpo-24484: Avoid race condition in multiprocessing cleanup

The finalizer registry can be mutated while inspected by multiprocessing
at process exit.

* Use test.support.start_threads()

* Add Misc/NEWS.
(cherry picked from commit 1eb6c0074d)
2017-06-13 17:51:26 +02:00
terryjreedy 2bfb45d447 bpo-30642: IDLE: Fix test_query refleak (#2147) (#2161)
Patch by Louie Lu.
(cherry picked from commit b070fd275b)
2017-06-13 10:11:02 -04:00
Nick Coghlan 92e9e35292 [3.6] bpo-29514: Check magic number for bugfix releases (#2157)
Add a test to check the current MAGIC_NUMBER against the
expected number for the release if the current release is
at candidate or final level. On test failure, describe to
the developer the procedure for changing the magic number.

This ensures that pre-merge CI will automatically pick up
on magic number changes in maintenance releases (and
explain why those are problematic), rather than relying on
all core developers to be aware of the implications of
such changes.
2017-06-13 20:32:46 +10:00
Dino Viehland 2997fec01e [3.6] bpo-30604: Move co_extra_freefuncs to interpreter state to avoid crashes in threads (#2015)
* Move co_extra_freefuncs to interpreter state to avoid crashes in
multi-threaded scenarios involving deletion of code objects

* Don't require that extra be zero initialized

* Build test list instead of defining empty test class

* Ensure extra is always assigned on success

* Keep the old fields in the thread state object, just don't use them
Add new linked list of code extra objects on a per-interpreter basis
  so that interpreter state size isn't changed

* Rename __PyCodeExtraState_Get and add comment about it going away in 3.7
Fix sort order of import's in test_code.py

* Remove an extraneous space

* Remove docstrings for comments

* Touch up formatting

* Fix casing of coextra local

* Fix casing of another variable

* Prefix PyCodeExtraState with __ to match C API for getting it

* Update NEWS file for bpo-30604
2017-06-12 21:46:35 -04:00
Serhiy Storchaka d89dc844d2 [3.6] bpo-28994: Fixed errors handling in atexit._run_exitfuncs(). (GH-2034) (#2121)
The traceback no longer displayed for SystemExit raised in a callback registered by atexit..
(cherry picked from commit 3fd54d4a7e)
2017-06-12 09:02:13 +03:00
terryjreedy 57d8de8031 [3.6]bpo-20185: Adjust IDLE test to 3.7 Clinic change [GH-542] (#2116)
Synchronize 3.6/3.7 test_calltips to the extent possible.  Part of patch by Serhiy Storchaka.
(cherry-pick from fdd42c4)
2017-06-11 14:29:38 -04:00
terryjreedy a895f91a46 [3.6]bpo-29995: Adjust IDLE test for 3.7 re.escape change [GH-1007] (#2114) 2017-06-11 13:50:51 -04:00
Zachary Ware f57e34b672 [3.6] Use Travis to make sure all generated files are up to date (GH-2080) (GH-2092)
(cherry picked from commit 0afbabe245)

Also fixes some line endings missed in GH-840 backport.
2017-06-11 11:30:57 -05:00
Yury Selivanov 83d30bd667 Revert "[3.6] bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (GH-409) (#2062)" (#2112)
This reverts commit 6e14fd2a14.
2017-06-11 16:46:45 +02:00
Yury Selivanov 176f2ebdad bpo-30508: Don't log exceptions if Task/Future "cancel()" method was called. (#2109) 2017-06-11 14:00:14 +00:00
terryjreedy 59422a29ee [3.6]bpo-30022: idlelib.run IOError -> OSError [GH-1051] (#2107)
Part of patch by Serhiy Storchaka.
(cherry-pick from 55fe1ae970)
2017-06-11 06:26:25 -04:00
terryjreedy a13225e209 [3.6]bpo-30144: change idlelib abc import [GH-1263] (#2106)
Part of patch by Serhiy Storchaka.
(cherry-pick from 2e576f5)
2017-06-11 06:12:31 -04:00
terryjreedy c6696feb09 [3.6] bpo-29919 Remove unused imports from idlelib [GH-137] (#2105)
Part of patch by Victor Stinner.
(cherry-pick from d6debb24e0)
2017-06-11 05:53:46 -04:00
terryjreedy d755d19ac4 [3.6] Remove unused imports (#2104)
Part of patch by Serhiy Strochaka, 2016-12-16 (no bpo issue)
(cherry-pick of 70d28a184c)
2017-06-11 04:45:35 -04:00
terryjreedy ccccf3156f bpo-30495: IDLE: Modernize textview.py with docstrings and PEP8 names (#1839) (#2102)
Patch by Cheryl Sabella.
(cherry picked from commit 0aa0a06e8b)
2017-06-11 04:16:55 -04:00
terryjreedy c0ef607c52 [3.6] bpo-30166: backport pyshell changes (GH 1293) (#2098)
(cherry-pick IDLE pyshell change from 7e4db2f)
2017-06-11 00:34:20 -04:00
terryjreedy 556cddba77 [3.6] Update idlelib NEWS for 3.6 (GH-2089) (#2097)
(cherry-picked from 503bc63)
2017-06-10 23:48:00 -04:00
Mariatta 8d15b19be6 bpo-28556: Updates to typing module (GH-2076) (GH-2087)
This PR contains two updates to typing module:

- Support ContextManager on all versions (original PR by Jelle Zijlstra).
- Add generic AsyncContextManager..
(cherry picked from commit 29fda8db16)
2017-06-10 14:41:00 -07:00
Zachary Ware 964c261dc9 [3.6] bpo-27425: Be more explicit in .gitattributes (GH-840) (GH-2083)
Also updates checked-in line endings on some files
2017-06-10 15:39:29 -05:00
Yury Selivanov 6e14fd2a14 [3.6] bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (GH-409) (#2062)
* bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (#409)

(cherry picked from commit a608d2d5a7)

* [3.6] bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (GH-409)

* asyncio SSL contexts leak sockets after calling close with certain servers

* cleanup _shutdown_timeout_handle on _fatal_error.
(cherry picked from commit a608d2d5a7)
2017-06-10 10:00:45 -04:00
terryjreedy 12cbd87ac0 [3.6] bpo-30290: IDLE - pep8 names and tests for help-about (#2070)
(cherry picked from commit 054e09147a)

* bpo-30290: IDLE: Refactor help_about to PEP8 names (#1714)

Patch by Cheryl Sabella.
(cherry picked from commit 5a346d5dbc)

* IDLE test_help_about: edit and add test. (#1838)

Coverage is now 100%
(cherry picked from commit eca7da0f13)
2017-06-10 02:53:19 -04:00
Yury Selivanov 361362f3a0 [3.6] Fix TypeError is asyncio/proactor_events (GH-993) (#2061)
(cherry picked from commit 34792d25ab)
2017-06-10 00:15:28 -04:00
Mariatta 753422f6e3 bpo-30266: support "= None" pattern in AbstractContextManager (GH-1448) (GH-2054)
contextlib.AbstractContextManager now supports anti-registration
by setting __enter__ = None or __exit__ = None, following the pattern
introduced in bpo-25958..
(cherry picked from commit 57161aac5e)
2017-06-09 20:36:28 -07:00
Yury Selivanov fe9c7a0fd3 Break circular references when closing SSLTransport objects (#981) (#2049) 2017-06-09 19:14:35 -04:00
Yury Selivanov 7a16a4535d Closing transport during handshake process leaks socket (#480) (#2044) 2017-06-09 18:33:31 -04:00
Yury Selivanov fa7f519113 Fix waiter cancellation in asyncio.Lock (#1031) (#2037)
Avoid a deadlock when the waiter who is about to take the lock is
cancelled

Issue #27585
2017-06-09 17:07:48 -04:00
Yury Selivanov e89f95bfd0 [3.6] bpo-30039: Don't run signal handlers while resuming a yield from stack (GH-1081) (#1640)
If we have a chain of generators/coroutines that are 'yield from'ing
each other, then resuming the stack works like:

- call send() on the outermost generator
- this enters _PyEval_EvalFrameDefault, which re-executes the
  YIELD_FROM opcode
- which calls send() on the next generator
- which enters _PyEval_EvalFrameDefault, which re-executes the
  YIELD_FROM opcode
- ...etc.

However, every time we enter _PyEval_EvalFrameDefault, the first thing
we do is to check for pending signals, and if there are any then we
run the signal handler. And if it raises an exception, then we
immediately propagate that exception *instead* of starting to execute
bytecode. This means that e.g. a SIGINT at the wrong moment can "break
the chain" – it can be raised in the middle of our yield from chain,
with the bottom part of the stack abandoned for the garbage collector.

The fix is pretty simple: there's already a special case in
_PyEval_EvalFrameEx where it skips running signal handlers if the next
opcode is SETUP_FINALLY. (I don't see how this accomplishes anything
useful, but that's another story.) If we extend this check to also
skip running signal handlers when the next opcode is YIELD_FROM, then
that closes the hole – now the exception can only be raised at the
innermost stack frame.

This shouldn't have any performance implications, because the opcode
check happens inside the "slow path" after we've already determined
that there's a pending signal or something similar for us to process;
the vast majority of the time this isn't true and the new check
doesn't run at all..
(cherry picked from commit ab4413a7e9)
2017-06-09 17:06:39 -04:00
Victor Stinner b7577456c4 bpo-30524: Write unit tests for FASTCALL (#2022) (#2030)
Test C functions:

* _PyObject_FastCall()
* _PyObject_FastCallDict()
* _PyObject_FastCallKeywords()
(cherry picked from commit 3b5cf85edc)
2017-06-09 22:28:32 +02:00
terryjreedy bbeaccc76b [3.6] IDLE test_textview: add comments and test, increase coverage to 100% (GH-1641) (#2018)
(cherry picked from commit 295304d412)
2017-06-09 15:59:31 -04:00
Serhiy Storchaka 570b1c971c [3.6] bpo-30529: Fix errors for invalid whitespaces in f-string subexpressions. (GH-1888) (#2013)
'invalid character in identifier' now is raised instead of
'f-string: empty expression not allowed' if a subexpression contains
only whitespaces and they are not accepted by Python parser.
(cherry picked from commit 2e9cd58)
2017-06-09 00:38:06 +03:00
Victor Stinner b319d09ee4 bpo-30418: Popen.communicate() always ignore EINVAL (#2002) (#2004)
On Windows, subprocess.Popen.communicate() now also ignore EINVAL
on stdin.write() if the child process is still running but closed the
pipe.
(cherry picked from commit d52aa31378)
2017-06-08 23:14:07 +02:00
Denis Osipov ca1b66fd05 [3.6] bpo-30584: Fix test_os fails on non-English Windows (GH-1980) (#1999)
* Fix bpo-30584

* Adding a comment mentionning the bpo and explaining what is the identifier

* Add Denis Osipov to Misc/ACKS
(cherry picked from commit 897bba7563)
2017-06-08 14:02:05 +02:00
Antoine Pietri ceabf9acf0 bpo-30177: pathlib: include the full path in resolve(strict=False) (#1893) (#1985) 2017-06-07 10:18:56 -07:00
Nate 09b6c0c71e [3.6] bpo-29822: make inspect.isabstract() work during __init_subclass__ (#1979)
At the time when an abstract base class' __init_subclass__ runs,
ABCMeta.__new__ has not yet finished running, so in the presence of
__init_subclass__, inspect.isabstract() can no longer depend only on
TPFLAGS_IS_ABSTRACT.
(cherry picked from commit fcfe80ec25)
2017-06-07 07:21:34 +03:00
Nate 6fb12b5c43 bpo-29581: bpo-29581: Make ABCMeta.__new__ pass **kwargs to type.__new__ (GH-527) (GH-1282)
Many metaclasses in the standard library don't play nice with
__init_subclass__. This bug makes ABCMeta in particular with
__init_subclass__, which is an 80/20 solution for me personally.
AFAICT, a general solution to this problem requires updating all
metaclasses in the standard library to make sure they pass **kwargs to
type.__new__, whereas this PR only fixes ABCMeta. For context, see
https://bugs.python.org/issue29581.

* added a test combining ABCMeta and __init_subclass__
* Added NEWS item

(cherry picked from commit bd583ef985)

* [3.6] bpo-29581: Make ABCMeta.__new__ pass **kwargs to type.__new__ (GH-527)

Many metaclasses in the standard library don't play nice with
__init_subclass__. This bug makes ABCMeta in particular with
__init_subclass__, which is an 80/20 solution for me personally.
AFAICT, a general solution to this problem requires updating all
metaclasses in the standard library to make sure they pass **kwargs to
type.__new__, whereas this PR only fixes ABCMeta. For context, see
https://bugs.python.org/issue29581.

* added a test combining ABCMeta and __init_subclass__
* Added NEWS item.
(cherry picked from commit bd583ef985)

* **kwargs -> ``kwargs`` in attempts to fix the Travis build.

* Quote the **kwargs
2017-06-06 17:31:03 -07:00
Steve Dower 2bafc0dcca [3.6] bpo-30557: faulthandler now correctly filters and displays exception … (#1960)
* bpo-30557: faulthandler now correctly filters and displays exception codes on Windows (#1924)

* bpo-30557: faulthandler now correctly filters and displays exception codes on Windows

* Adds test for non-fatal exceptions.

* Adds bpo number to comment.

* bpo-30557: Fix test_faulthandler (#1969)

On Windows 8, 8.1 and 10 at least, the exit code is the exception
code (no bit is cleared).
2017-06-06 13:47:14 -07:00
Mariatta e1a60d9032 [3.6] bpo-30303: IDLE: Add _utest argument to textview (GH-1499) (#1916)
(cherry picked from commit ba365da9ce)
2017-06-06 11:56:59 -04:00
Zachary Ware 7e6d999b6c [3.6] Fix skipping test_UNC_path on AppVeyor due to a different error being raised (GH-1920)
We get `ERROR_BAD_NETPATH` (53) on AppVeyor which is translated to
ENOENT (2).
(cherry picked from commit 7a99625e0d)
2017-06-04 17:14:03 -05:00
Xiang Zhang 95b4da2be4 bpo-30378: Fix the problem that SysLogHandler can't handle IPv6 addresses (#1676) (#1903) 2017-06-01 22:20:27 +08:00
Mariatta 94d8261d1c [3.6] bpo-29960 _random.Random corrupted on exception in setstate(). … (#1287)
(cherry picked from commit 9616a82e78)
2017-05-27 07:20:24 -07:00
Serhiy Storchaka b52c68a5a3 [3.6] bpo-30398: Add a docstring for re.error. (GH-1647) (#1830)
Also document that some attributes may be None.
(cherry picked from commit 12d6b5d)
2017-05-27 16:37:40 +03:00
Antoine Pitrou 2783cc4262 [3.6] bpo-30414: multiprocessing.Queue._feed do not break from main loop on exc (GH-1683) (#1815)
* bpo-30414: multiprocesing.Queue._feed do not break from main loop on exc

Queue background running thread was not handling exceptions correctly.
Any exception occurred inside thread (putting unpickable object) cause
feeder to finish running. After that every message put into queue is
silently ignored.

* bpo-30414: multiprocesing.Queue._feed do not break from main loop on exc

Queue background running thread was not handling exceptions correctly.
Any exception occurred inside thread (putting unpickable object) cause
feeder to finish running. After that every message put into queue is
silently ignored.
(cherry picked from commit bc50f03db4)
2017-05-25 16:57:46 +02:00
Serhiy Storchaka 89a3102640 [3.6] bpo-29104: Fixed parsing backslashes in f-strings. (GH-490) (#1812)
(cherry picked from commit 0cd7a3f)
2017-05-25 14:18:55 +03:00
Stéphane Wirtel c3454f0e79 bpo-30394: Fix a socket leak in smtplib.SMTP.__init__() (#1700) (#1790) 2017-05-25 02:59:06 +08:00
Łukasz Langa 70705e3cdf [3.6] call remove_done_callback in finally section (GH-1688) (#1755)
(cherry picked from commit 21b3e04c13)
2017-05-23 00:36:23 -07:00
Vijay Kumar 762add7877 Fix spelling mistakes in tkinter.py (#1751)
Ran the docstrings through spell checker, and fixed spelling issues.
2017-05-23 09:14:02 +03:00
Łukasz Langa e8412e684e [3.6] bpo-23894: make lib2to3 recognize f-strings (GH-1733) (#1737)
Note: this doesn't unpack f-strings into the underlying JoinedStr AST.

Ideally we'd fully implement JoinedStr here but given its additional
complexity, I think this is worth bandaiding as is. This unblocks tools like
https://github.com/google/yapf to format 3.6 syntax using f-strings.
(cherry picked from commit 1b9530c536)
2017-05-22 22:23:29 -07:00
Łukasz Langa 1398b1bc7d [3.6] Make rb'' strings work in lib2to3 (GH-1724) (#1730)
This partially solves bpo-23894.
(cherry picked from commit 0c4aca54dc)
2017-05-22 16:35:15 -07:00
Xiang Zhang 54af41d42e bpo-30003: Fix handling escape characters in HZ codec (#1556) (#1719) 2017-05-23 01:03:00 +08:00
delirious-lettuce 0702cc01fa [3.6] Fix typos in multiple `.rst` files (GH-1668) (#1702)
(cherry picked from commit 3378b2062c)
2017-05-22 00:26:01 +03:00
Serhiy Storchaka cf5c1be8f6 [3.6] bpo-30415: Add new tests for the fnmatch module. (GH-1684) (#1694)
(cherry picked from commit 8175547)
2017-05-21 10:35:39 +03:00
Senthil Kumaran b5bf7e85b7 bpo-29976: urllib.parse clarify '' in scheme values. (GH-984) (GH-1692)
(cherry picked from commit 906f5330b9)
2017-05-20 23:23:03 -07:00
Serhiy Storchaka 564398af6c [3.6] bpo-27945: Fixed various segfaults with dict. (GH-1657) (#1677)
Based on patches by Duane Griffin and Tim Mitchell.
(cherry picked from commit 753bca3934)
2017-05-20 13:06:26 +03:00
Serhiy Storchaka 193f7e094f [3.6] bpo-25794: Fix `type.__setattr__()` for non-interned attribute names. (GH-1652) (#1673)
Based on patch by Eryk Sun.
(cherry picked from commit d896985bb2)
2017-05-20 10:23:31 +03:00
Victor Stinner 2773add19a bpo-27103: regrtest disables -W if -R is used (#1651) (#1656)
Workaround for a regrtest bug.
(cherry picked from commit fcdd9b6b7e)
2017-05-18 13:36:51 -07:00
Victor Stinner 44944b602a bpo-30387: Fix warning in test_threading (#1634) (#1636)
test_is_alive_after_fork() now joins directly the thread to avoid the
following warning added by bpo-30357:

Warning -- threading_cleanup() failed to cleanup 0 threads
after 2 sec (count: 0, dangling: 21)

Use also a different exit code to catch generic exit code 1.
(cherry picked from commit f8d05b3a24)
2017-05-17 14:49:38 -07:00
Senthil Kumaran 0d1727835f Remove unused variable in test_urllibnet. (#1598) (#1600)
(cherry picked from commit 1bd7d299bd)
2017-05-17 10:51:01 -07:00
Xiang Zhang 43d4c0329e bpo-30301: Fix AttributeError when using SimpleQueue.empty() (#1601) (#1628)
Under *spawn* and *forkserver* start methods, SimpleQueue.empty() could
raise AttributeError due to not setting _poll in __setstate__.
2017-05-17 22:03:35 +08:00
Victor Stinner 460945f22a bpo-30273: update distutils.sysconfig for venv's created from Python (#1515) (#1625)
compiled out-of-tree (builddir != srcdir). (see also bpo-15366)
(cherry picked from commit dbdea629e2)
2017-05-16 17:58:02 -07:00
Victor Stinner 6b5b85aecf bpo-30357: test_thread now uses threading_cleanup() (#1592) (#1622)
test_thread: setUp() now uses support.threading_setup() and
support.threading_cleanup() to wait until threads complete to avoid
random side effects on following tests.

Co-Authored-By:  Grzegorz Grzywacz <grzegorz.grzywacz@nazwa.pl>
(cherry picked from commit 79ef7f8e88)
2017-05-16 17:06:14 -07:00
Victor Stinner aaa0536525 bpo-30329: Catch Windows error 10022 on shutdown() (#1538) (#1620)
Catch the Windows socket WSAEINVAL error (code 10022) in imaplib and
poplib on shutdown(SHUT_RDWR): An invalid operation was attempted

This error occurs sometimes on SSL connections.
(cherry picked from commit 83a2c28798)
2017-05-16 15:29:41 -07:00
Serhiy Storchaka 73fb45df04 [3.6] bpo-30375: Correct the stacklevel of regex compiling warnings. (GH-1595) (#1604)
Warnings emitted when compile a regular expression now always point
to the line in the user code.  Previously they could point into inners
of the re module if emitted from inside of groups or conditionals..
(cherry picked from commit c7ac7280c3)
2017-05-16 18:16:15 +03:00
Xiang Zhang 0ce1f7e02d bpo-30110: fix resource leak in test_asyncio.test_events (#1413) (#1584) 2017-05-15 13:17:01 +08:00
Victor Stinner d05f7fdf6c [3.6] bpo-30345: Update test_gdb.py and python-gdb.py from master (#1549)
* python-gdb.py supports method-wrapper

bpo-29367: python-gdb.py now supports also method-wrapper (wrapperobject)
objects.

(cherry picked from commit 611083331d)

* Update and enhance python-gdb.py

bpo-29259: Detect PyCFunction is the current frame, not only in the
older frame.
2017-05-13 00:21:50 +02:00
INADA Naoki 3dc7c52a9f bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1546)
when there are no more `await` or `yield (from)` before return in coroutine,
cancel was ignored.

example:

    async def coro():
        asyncio.Task.current_task().cancel()
        return 42
    ...
    res = await coro()  # should raise CancelledError

(cherry picked from commit 991adca012)
2017-05-11 21:56:42 +09:00
Victor Stinner 81ed537846 bpo-30320: test_eintr now uses pthread_sigmask() (#1523) (#1524)
Rewrite sigwaitinfo() and sigtimedwait() unit tests for EINTR using
pthread_sigmask() to fix a race condition between the child and the
parent process.

Remove the pipe which was used as a weak workaround against the race
condition.

sigtimedwait() is now tested with a child process sending a signal
instead of testing the timeout feature which is more unstable
(especially regarding to clock resolution depending on the platform).
(cherry picked from commit 211a392cc1)
2017-05-10 08:47:22 +02:00
Serhiy Storchaka 418d60a525 [3.6] bpo-30298: Weaken the condition of deprecation warnings for inline modifiers. (GH-1490) (#1525)
Now allowed several subsequential inline modifiers at the start of the
pattern (e.g. '(?i)(?s)...').  In verbose mode whitespaces and comments
now are allowed before and between inline modifiers (e.g.
'(?x) (?i) (?s)...')..
(cherry picked from commit 305ccbe27e)
2017-05-10 06:44:02 +03:00
Xiang Zhang 72e1b61da0 bpo-29990: Fix range checking in GB18030 decoder (#1495) (#1507)
When decoding a 4-byte GB18030 sequence, the first and third byte cannot exceed 0xFE.
2017-05-09 12:16:50 +08:00
Serhiy Storchaka 70dc6a7a0b [3.6] Revert bpo-26293 for zipfile breakage. See also bpo-29094. (GH-1484). (#1485)
(cherry picked from commit 3763ea865c)
2017-05-06 15:10:50 +03:00
Victor Stinner 0fe870f3f9 bpo-30264: ExpatParser closes the source on error (#1451) (#1474)
ExpatParser.parse() of xml.sax.xmlreader now always closes the
source: close the file object or the urllib object if source is a
string (not an open file-like object). The change fixes a
ResourceWarning on parsing error.

Add test_parse_close_source() unit test.
(cherry picked from commit ef9c0e732f)
2017-05-05 10:04:57 +02:00
Victor Stinner 9d02f56296 [3.6] bpo-23404: make touch becomes make regen-all (#1405) (#1461)
* bpo-23404: make touch becomes make regen-all (#1405)

Don't rebuild generated files based on file modification time
anymore, the action is now explicit. Replace "make touch"
with "make regen-all".

Changes:

* Remove "make touch", Tools/hg/hgtouch.py and .hgtouch
* Add a new "make regen-all" command to rebuild all generated files
* Add subcommands to only generate specific files:

  - regen-ast: Include/Python-ast.h and Python/Python-ast.c
  - regen-grammar: Include/graminit.h and Python/graminit.c
  - regen-importlib: Python/importlib_external.h and Python/importlib.h
  - regen-opcode: Include/opcode.h
  - regen-opcode-targets: Python/opcode_targets.h
  - regen-typeslots: Objects/typeslots.inc

* Rename PYTHON_FOR_GEN to PYTHON_FOR_REGEN
* pgen is now only built by by "make regen-grammar"
* Add $(srcdir)/ prefix to paths to source files to handle correctly
  compilation outside the source directory

Note: $(PYTHON_FOR_REGEN) is no more used nor needed by "make"
default target building Python.
(cherry picked from commit a5c62a8e9f)

* bpo-30273: Update sysconfig (#1464)

The AST_H_DIR variable was removed from Makefile.pre.in by the commit
a5c62a8e9f (bpo-23404).

AST_H_DIR was hardcoded to "Include", so replace the removed variable
by its content.

Remove also ASDLGEN variable from sysconfig example since this
variable was also removed.
(cherry picked from commit b109a1d336)
2017-05-05 00:46:56 +02:00
Antoine Pitrou a7e48b544b [3.6] bpo-30185: avoid KeyboardInterrupt tracebacks in forkserver (GH-1319) (#1454)
* bpo-30185: avoid KeyboardInterrupt tracebacks in forkserver

* Tweak comment.
(cherry picked from commit 6dd4d734ed)
2017-05-04 17:12:35 +02:00
Serhiy Storchaka 1bebd8a219 [3.6] bpo-30184: Add tests for invalid use of PyArg_ParseTupleAndKeywords. (GH-1316). (#1441)
(cherry picked from commit 5f161fd86d)
2017-05-04 06:50:28 +03:00
Mariatta e612c28513 [3.6] bpo-28556: Routine updates to typing (GH-1366) (#1416)
- Add NoReturn type
- Use WrapperDescriptorType (original PR by Jim Fasarakis-Hilliard)
- Minor bug-fixes
(cherry picked from commit f06e0218ef)
2017-05-03 09:38:01 -07:00
Victor Stinner 564e89f43b regrtest: always show before/after of modified env (#1192) (#1406)
Buildbots don't run tests with -vv and so only log "xxx was modified
by test_xxx" which is not enough to debug such random issue. In many
cases, I'm unable to reproduce the warning and so unable to fix it.

Always logging the value before and value after should help to debug
such warning on buildbots.
(cherry picked from commit ec4b17239d)
2017-05-03 02:12:22 +02:00
Antoine Pitrou 0c2ff0898d Backport bpo-30205 to 3.6 (#1403) 2017-05-03 00:14:29 +02:00
Victor Stinner 3c422b9265 bpo-30199: test_ssl closes all asyncore channels (#1381) (#1390)
AsyncoreEchoServer of test_ssl now calls
asyncore.close_all(ignore_all=True) to ensure that
asyncore.socket_map is cleared once the test completes, even if
ConnectionHandler was not correctly unregistered.

Fix the following warning:

Warning -- asyncore.socket_map was modified by test_ssl
  Before: {}
  After:  {6: <test.test_ssl.AsyncoreEchoServer.EchoServer.ConnectionHandler>}
(cherry picked from commit 1dae7450c6)
2017-05-02 16:49:10 +02:00
Victor Stinner 3076895849 bpo-30132: distutils BuildExtTestCase use temp_cwd (#1387)
BuildExtTestCase of test_distutils now uses support.temp_cwd() in
setUp() to remove files created in the current working in all
BuildExtTestCase unit tests, not only test_build_ext().

Fix the following warning:

Warning -- files was modified by test_distutils
  Before: []
  After:  ['vc140.pdb']
2017-05-02 15:50:42 +02:00
Victor Stinner 33a5d40de9 bpo-30108: Restore sys.path in test_site (#1197) (#1378)
Add setUpModule() and tearDownModule() functions to test_site to
save/restore sys.path at the module level to prevent warning if the
user site directory is created, since site.addsitedir() modifies
sys.path.
(cherry picked from commit b85c136903)
2017-05-02 11:45:42 +02:00
Serhiy Storchaka 712114b3f9 [3.6] bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (GH-1341) (#1345)
They now work when delete replaced attribute or item inside the with
statement.  The old value of the attribute or item (or None if it doesn't
exist) now will be assigned to the target of the "as" clause, if there is
one.

(cherry picked from commit d1a1def7bf)
2017-04-28 20:05:05 +03:00
Victor Stinner e005dd9a6d bpo-30125: disable faulthandler in ctypes test_SEH (#1237) (#1343)
Disable faulthandler to run test_SEH() of test_ctypes to prevent the
following log with a traceback:

    Windows fatal exception: access violation

Add support.disable_faulthandler() context manager.
(cherry picked from commit a36e939aeb)
2017-04-28 16:06:48 +02:00
Victor Stinner cb21f5f3d2 bpo-30131: test_logging now joins queue threads (#1298) (#1317)
QueueListenerTest of test_logging now closes the multiprocessing
Queue and joins its thread to prevent leaking dangling threads to
following tests.

Add also @support.reap_threads to detect earlier if a test leaks
threads (and try to "cleanup" these threads).
(cherry picked from commit 8ca2f2faef)
2017-04-28 04:13:53 +02:00
Victor Stinner caa59c156d [3.6] bpo-30106: Fix test_asyncore.test_quick_connect() (#1336)
* Fix/optimize test_asyncore.test_quick_connect() (#1188)

Don't use addCleanup() in test_quick_connect() because it keeps the
Thread object alive and so @reap_threads fails on its timeout of 1
second. "./python -m test -v test_asyncore -m test_quick_connect"
now takes 185 ms, instead of 11 seconds.

Other minor changes:

* Use "with sock:" to close the socket instead of
  try/finally: sock.close()
* Use self.skipTest() in test_quick_connect() to remove one
  indentation level and notice user that the test is specific to
  AF_INET and AF_INET6

* bpo-30106: Fix tearDown() of test_asyncore (#1194)

Call asyncore.close_all() with ignore_all=True in the tearDown()
method of the test_asyncore base test case. It should prevent keeping
alive sockets in asyncore.socket_map if close() fails with an
unexpected error.

Revert also an unwanted change of my previous commit: remove name
parameter of Thread in test_quick_connect().

* bpo-30106: Fix test_asyncore.test_quick_connect() (#1234)

test_quick_connect() runs a thread up to 50 seconds, whereas the
socket is connected in 0.2 second and then the thread is expected to
end in less than 3 second. On Linux, the thread ends quickly because
select() seems to always return quickly. On FreeBSD, sometimes
select() fails with timeout and so the thread runs much longer than
expected.

Fix the thread timeout to fix a race condition in the test.
2017-04-28 04:13:37 +02:00
Victor Stinner c9ca57eeea bpo-30107: Make SuppressCrashReport quiet on macOS (#1279) (#1335)
On macOS, SuppressCrashReport now redirects /usr/bin/defaults command
stderr into a pipe to not pollute stderr. It fixes a
test_io.test_daemon_threads_shutdown_stderr_deadlock() failure when
the CrashReporter domain doesn't exists. Message logged into stderr:

2017-04-24 16:57:21.432 defaults[41046:2462851]
The domain/default pair of (com.apple.CrashReporter, DialogType) does not exist
(cherry picked from commit d819ad9832)
2017-04-28 03:27:51 +02:00
Victor Stinner 4dc3b9cf2a bpo-30175: Skip client cert tests of test_imaplib (#1320) (#1323)
* bpo-30175: Skip client cert tests of test_imaplib

The IMAP server cyrus.andrew.cmu.edu doesn't accept our randomly
generated client x509 certificate anymore.

* bpo-30188: Catch EOFError in NetworkedNNTPTests

test_nntplib fails randomly with EOFError in
NetworkedNNTPTests.setUpClass(). Catch EOFError to skip tests in that
case.

(cherry picked from commit 5bccca58b9)
2017-04-27 18:25:03 +02:00
Mariatta a3d8dda7d8 bpo-30098: Clarify that run_coroutine_threadsafe expects asyncio.Future (GH-1170) (#1247)
(cherry picked from commit ae5b3260dd)
2017-04-21 19:58:28 -07:00
Victor Stinner 3a8f8ea2ac bpo-30125: Fix faulthandler.disable() on Windows (#1243)
On Windows, faulthandler.disable() now removes the exception handler
installed by faulthandler.enable().
2017-04-21 23:17:33 +02:00
Victor Stinner b984a05d55 bpo-30107: don't dump core on expected test_io crash (#1235) (#1241)
test_io has two unit tests which trigger a deadlock:

* test_daemon_threads_shutdown_stdout_deadlock()
* test_daemon_threads_shutdown_stderr_deadlock()

These tests call Py_FatalError() if the expected bug is triggered
which calls abort(). Use test.support.SuppressCrashReport to prevent
the creation on a core dump, to fix the warning:

Warning -- files was modified by test_io
  Before: []
  After:  ['python.core']
(cherry picked from commit 2a1aed04b0)
2017-04-21 18:27:29 +02:00
Mariatta 430020500c [3.6] bpo-30109: Fix reindent.py (GH-1207) (GH-1208)
Skip the file if it has bad encoding.
(cherry picked from commit 58f3c9dc8f)
2017-04-20 07:12:37 -07:00
Dong-hee Na df5df13fdc [3.6] bpo-12414: Update code_sizeof() to take in account co_extra memory. (#1168) (#1198) 2017-04-20 11:26:25 +03:00
Berker Peksag 596e714d79 bpo-30078: Add an example of passing a path to unittest (GH-1178)
(cherry picked from commit f7e62cf8ad)
2017-04-20 07:36:57 +03:00
Serhiy Storchaka e254617262 [3.6] bpo-30065: Fixed arguments validation in _posixsubprocess.fork_exec(). (GH-1110) (#1186)
(cherry picked from commit 66bffd1)
2017-04-19 23:59:02 +03:00
Serhiy Storchaka 39dedb6e1a [3.6] bpo-30070: Fixed leaks and crashes in errors handling in the parser module. (GH-1131). (#1184)
(cherry picked from commit a79f4c2195)
2017-04-19 23:22:19 +03:00
Serhiy Storchaka 680fea4067 bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (#1096) (#1180)
raised an error.

(cherry picked from commit bf623ae884)
2017-04-19 21:22:49 +03:00
Serhiy Storchaka 8e5b52a8da bpo-30017: Allowed calling the close() method of the zip entry writer object (#1041) (#1092)
multiple times.  Writing to closed zip entry writer object now always produce
a ValueError.
(cherry picked from commit 4c0d9ea995)
2017-04-16 12:04:45 +03:00
Xiang Zhang d5fa5f3ce7 bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present (#1130) (#1150) 2017-04-15 13:25:15 +08:00
Jack McCracken 7ac96ec60e Fix misplaced positional argument in OS X support library (#1137) 2017-04-14 17:44:34 +03:00
Antoine Pitrou 413a8913ae Relax test timing (bpo-29861) to avoid sporadic failures (#1120) (#1132)
(cherry picked from commit 685cdb9acc)
2017-04-14 13:37:46 +02:00
Mariatta cbc46afa59 [3.6] bpo-29694: race condition in pathlib mkdir with flags parents=True (GH-1089). (GH-1126)
(cherry picked from commit 22a594a004)
2017-04-13 19:26:16 -07:00
Mariatta 2cdf087d1f [3.6] bpo-29869: Allow underscores in numeric literals in lib2to3. (GH-1119) (GH-1122)
* Allow underscores in numeric literals in lib2to3.
* Stricter literal parsing for Python 3.6 in lib2to3.pgen2.tokenize.
* Add test case for underscores in literals in Python 3.
(cherry picked from commit a6e395dffa)
2017-04-13 16:54:49 -07:00
Mariatta 84c2d75489 Revert "bpo-29869: Allow underscores in numeric literals in lib2to3. (GH-752)" (GH-1109)
This reverts commit 97a40b7a5b.
The commit is supposed to go to the master branch first.
2017-04-13 04:03:16 -07:00
Nevada Sanchez 97a40b7a5b bpo-29869: Allow underscores in numeric literals in lib2to3. (GH-752) 2017-04-13 03:21:05 -07:00
Mariatta 9b409ff41c [3.6] bpo-29692: contextlib.contextmanager may incorrectly unchain RuntimeError (GH-949) (#1105)
contextlib._GeneratorContextManager.__exit__ includes a special case to deal with
PEP 479 RuntimeErrors created when `StopIteration` is thrown into the context
manager body.

Previously this check was too permissive, and undid one level of chaining on *all*
RuntimeError instances, not just those that wrapped a StopIteration instance.
(cherry picked from commit 00c75e9a45)
2017-04-13 02:50:21 -07:00
Mariatta bd1173f202 [3.6] Clarify exception handler scope in contextlib (GH-1103)
Moved explicit raise from inside try to try...else.
(cherry picked from commit 680e20beee)
2017-04-12 20:52:39 -07:00
Mariatta bc9025012f [3.6] Remove superfluous comment in urllib.error. (GH-1076) (GH-1101)
(cherry picked from commit 6fab78e902)
2017-04-12 20:45:54 -07:00
Xiang Zhang 14944c6230 bpo-26985: Add missing info of code object in inspect documentation (GH-1090) (GH-1099) 2017-04-13 11:14:17 +08:00
Senthil Kumaran 03066a05f5 Remove OSError related comment in urllib.request. (#1072)
(cherry picked from commit 6dfcc81f6b)
2017-04-09 20:37:44 -07:00
Senthil Kumaran 854ca174a9 Remove invalid comment in urllib.request. (#1055)
(cherry picked from commit a2a9ddd923)
2017-04-09 10:15:06 -07:00
Serhiy Storchaka af685f9050 bpo-29998: Pickling and copying ImportError now preserves name and path (#1010) (#1042)
attributes.
(cherry picked from commit b785396ab4)
2017-04-08 11:25:47 +03:00
Senthil Kumaran 19d61b265f Remove Invalid comment in test_urllib2.py. (#1022)
(cherry picked from commit fd0cd07a5a)
2017-04-07 00:56:59 -07:00
Senthil Kumaran ed278448da correct parse_qs and parse_qsl test case descriptions. (#968) (#997)
(cherry picked from commit 257b980b31)
2017-04-06 08:38:38 -07:00
Senthil Kumaran c4e557ed99 Minor spell fix and formatting fixes in urllib tests. (#959) (#961)
(cherry picked from commit efbd4ea65d)
2017-04-02 01:36:58 -07:00
Senthil Kumaran 4415b823a0 Add helpful explaination to test_password_manager tests. (#936) (#941)
Also uncomment and fix a path test.
(cherry picked from commit 1f5425ff69)
2017-04-01 19:57:04 -07:00
Serhiy Storchaka 7d5d13d8d0 bpo-29953: Fix memory leaks in the replace() method of datetime and t… (#933)
objects when pass out of bound fold argument.
(cherry picked from commit 314d6fca36)
2017-03-31 23:23:49 +03:00
Senthil Kumaran 8d1f935945 Remove catching OSError in ftphandler test. Only URLError is raised in urllib.request module. (#918) (#920)
(cherry picked from commit ed3dd1c02a)
2017-03-30 23:15:51 -07:00
T. Wouters 599bb18103 bpo-29942: Fix the use of recursion in itertools.chain.from_iterable. (#911)
* bpo-29942: Fix the use of recursion in itertools.chain.from_iterable.

Fix the use of recursion in itertools.chain.from_iterable. Using recursion
is unnecessary, and can easily cause stack overflows, especially when
building in low optimization modes or with Py_DEBUG enabled.
(cherry picked from commit 5466d4af5f)
2017-03-30 12:48:23 -07:00
Serhiy Storchaka a6b4e19022 bpo-27863: Fixed multiple crashes in ElementTree. (#765) (#903)
(cherry picked from commit 576def096e)
2017-03-30 18:08:21 +03:00
Senthil Kumaran 1b43a959fb Remove an unrequired TODO in test_urllib2. (#897) (#900)
(cherry picked from commit e6911a44f6)
2017-03-29 23:56:52 -07:00
Xiang Zhang 346dcd65e6 bpo-28699: fix abnormal behaviour of pools in multiprocessing.pool (GH-882)
an exception raised at the very first of an iterable would cause pools behave abnormally
(swallow the exception or hang)
2017-03-29 12:50:28 +08:00
Zachary Ware bc2031470e Minor test cleanup (GH-837) (GH-838)
* Remove unused test file

* Remove duplicated text in sndhdrdata README

(cherry picked from commit b8a7daf077)
2017-03-27 00:35:56 -05:00
Mariatta d2fc782410 import sys before we use it on line 9 (GH-828) (GH-833)
(cherry picked from commit 0579e81f30)
2017-03-26 19:53:37 -07:00
Mariatta 8b82236952 bpo-29862: Fix grammar in importlib.reload() exception (GH-809) (GH-811)
(cherry picked from commit 9f0aa4843f)
2017-03-25 03:41:59 -07:00
Serhiy Storchaka 8c8785b2f8 bpo-25803: Avoid incorrect errors raised by Path.mkdir(exist_ok=True)… (#806)
when the OS gives priority to errors such as EACCES over EEXIST.

(cherry picked from commit af7b9ec5c8)
2017-03-24 21:46:25 +02:00
Antoine Pitrou cc3331fec8 bpo-29861: release references to multiprocessing Pool tasks (#743) (#800)
* bpo-29861: release references to multiprocessing Pool tasks (#743)

* bpo-29861: release references to multiprocessing Pool tasks

Release references to tasks, their arguments and their results as soon
as they are finished, instead of keeping them alive until another task
arrives.

* Comments in test

(cherry picked from commit 8988945cdc)

* Fix Misc/NEWS (hopefully)
2017-03-24 14:45:34 +01:00
Xiang Zhang 72c51136c6 fix function name in tabnanny documentation (GH-762) 2017-03-22 15:26:53 +08:00
Serhiy Storchaka 6fad4090ec bpo-28876: bool of large range raises OverflowError (#699) (#734)
(cherry picked from commit e46fb86118)
2017-03-20 09:13:47 +02:00
Serhiy Storchaka da88596a19 bpo-29845: Mark tests that use _testcapi as CPython-only (#711) (#725)
(cherry picked from commit 24c738a9e9)
2017-03-19 20:53:42 +02:00
Serhiy Storchaka fca705d533 bpo-25455: Fixed crashes in repr of recursive buffered file-like objects. (#514) (#722)
(cherry picked from commit a5af6e1af7)
2017-03-19 20:27:16 +02:00
Vinay Sajip 46e81d3345 bpo-29808: Do not fail in SysLogHandler constructor if syslog isn't available. (#696)
bpo-29808: SysLogHandler: Do not fail if initial connect to syslog failed.

(cherry picked from commit 1b038e0738)
2017-03-17 19:52:56 +00:00
Berker Peksag 948171bf99 bpo-16355: Clarify when inspect.getcomments() returns None (#428) (#690)
Initial patch by Vajrasky Kok.

(cherry picked from commit 3f2155ffe6)
2017-03-17 14:59:16 +03:00
Mariatta 4ac01f0ff3 update test_socket AEAD test for kernel 4.9 and up (GH-133) (GH-548)
(cherry picked from commit 9764c151c5)
2017-03-16 20:58:42 -07:00
Berker Peksag 0dfd18a1e1 Fix stderr bug in json.tool test (#346) (#676)
See https://github.com/python/cpython/pull/201#discussion_r103229425.(cherry picked from commit b4e9087e7b)
2017-03-16 16:22:35 +03:00
Berker Peksag 78add3309b Change assertRaises to assertRaisesRegex in test_xmlrpc (#481) (#674)
(cherry picked from commit c6b448b36d)
2017-03-15 14:12:53 +03:00
Michael Seifert 53b2667dcf bpo-29800: Fix crashes in partial.__repr__ if the keys of partial.keywords are not strings (#649) (#671) 2017-03-15 09:42:02 +02:00
Xiang Zhang faa2cc63e4 bpo-28856: Let %b format for bytes support objects that follow the buffer protocol (GH-664) 2017-03-14 15:27:01 +08:00
Yury Selivanov 99f8d33a94 bpo-29742: asyncio get_extra_info() throws exception (#525) (#645) 2017-03-12 17:06:16 -04:00
Yury Selivanov fa448de97d Fix wrapping into StopIteration of return values in generators and coroutines (#644) (#647) 2017-03-12 17:04:06 -04:00
Nick Coghlan c60948464f [3.6] bpo-29723: Consistently configure sys.path[0] (#636)
Directory and zipfile execution previously added
the parent directory of the directory or zipfile
as sys.path[0] and then subsequently overwrote
it with the directory or zipfile itself.

This caused problems in isolated mode, as it
overwrote the "stdlib as a zip archive" entry
in sys.path, as the parent directory was
never added.

The attempted fix to that issue in bpo-29319
created the opposite problem in *non*-isolated
mode, by potentially leaving the parent
directory on sys.path instead of overwriting it.

This change fixes the root cause of the problem
by removing the whole "add-and-overwrite" dance
for sys.path[0], and instead simply never adds
the parent directory to sys.path in the first
place.
(cherry picked from commit d2977a3ae2)
2017-03-12 21:34:22 +10:00
Zachary Ware 7c6d6e0564 bpo-29763: Use support.unlink instead of os.unlink (GH-624) (GH-625)
support.unlink waits for the files to be removed before returning
2017-03-11 22:39:54 -06:00
Zachary Ware df6f3f6f57 fix subprocess on Windows (GH-391 backport) (GH-623) 2017-03-11 17:16:34 -06:00
Serhiy Storchaka 80dfbe30b7 [3.6] bpo-29773: Add more cases for testing string to float conversion errors. (#586)
(cherry picked from commit 9e6ac83aca)
2017-03-09 21:01:49 +02:00
orenmn 26d013e00f [3.6] bpo-28298: make array 'Q', 'L' and 'I' accept big intables as elements (#579) 2017-03-09 16:06:47 +02:00
Serhiy Storchaka eb65edd102 [3.6] bpo-28231: The zipfile module now accepts path-like objects for external paths. (#561)
(cherry picked from commit 8606e9524a)
2017-03-08 15:45:43 +02:00
Serhiy Storchaka 666165fddf [3.6] bpo-28230: Document the pathlib support in tarfile and add tests. (#559) 2017-03-08 12:29:33 +02:00
Benjamin Peterson 6a4b04cd33 Revert "bpo-29571: Use correct locale encoding in test_re (#149)" (#554) (#555)
This reverts commit ace5c0fdd9.
2017-03-07 23:56:59 -08:00
Xiang Zhang 78ad039bcf bpo-26915: Test identity first in index() and count() of collections.abc.Sequence (GH-553) 2017-03-08 11:43:35 +08:00
Xiang Zhang 284a2ba140 bpo-28728: clarify possible test failure due to ISP (GH-412) (GH-531) 2017-03-07 11:53:29 +08:00
Xiang Zhang df6d7b406f [3.6] bpo-29714: Fix a regression that bytes format may fail when containing zero bytes inside. (GH-504) 2017-03-06 18:17:10 +08:00
Ivan Levkivskyi b414e349eb bpo-29638: Fix spurious refleaks after typing is imported (#469) (#483) 2017-03-05 21:18:43 +02:00
Petr Motejlek 3405792b02 bpo-29615: backport to 3.6 (#478) 2017-03-05 18:14:06 +02:00
Ned Deily cefca3d7b5 Update pydoc topics for 3.6.0rc1 2017-03-04 12:18:43 -05:00
Ned Deily 1d391f926b [3.6] bpo-28087: Skip test_asyncore and test_eintr poll failures on macOS (#463)
Skip some tests of select.poll when running on macOS due to unresolved
issues with the underlying system poll function on some macOS versions.

(cherry picked from commit de04644627)
2017-03-04 06:19:05 -05:00
Ned Deily 95c50e5aed [3.6] bpo-27593: Get SCM build info from git instead of hg. (#446) (#454)
* bpo-27593: Get SCM build info from git instead of hg. (#446)

sys.version and the platform module python_build(),
python_branch(), and python_revision() functions now use
git information rather than hg when building from a repo.

Based on original patches by Brett Cannon and Steve Dower.
(cherry picked from commit 5c4b0d063a)
2017-03-04 01:05:06 -05:00
Berker Peksag 21ce65aa67 [3.6] bpo-29623: Make PathLike objects work with ConfigParser.read() (#242) (#432)
(cherry picked from commit 85b8d01c91)

Conflicts:

	Lib/test/test_configparser.py
2017-03-03 20:48:37 +03:00
Berker Peksag c7ff163abf Add Python version since deprecation in base64 methods. (#33) (#429)
Allow developers to not have to either test on N Python versions or
looked through multiple versions of the docs to know whether they can
easily update.

(cherry picked from commit c643a967dd)
2017-03-03 18:07:18 +03:00
Mariatta 93692b1a7c getpass: update docstrings (GH-49) (GH-419)
(cherry picked from commit baf7bb30a0)
2017-03-02 21:56:06 -08:00
Yury Selivanov d8b72e4a06 bpo-28963: Fix out of bound iteration in asyncio.Future.remove_done_callback/C (#408) 2017-03-03 00:05:22 -05:00
Yury Selivanov 2ef08d3be7 asyncio: Optimize _get_running_loop() to call getpid() only when there's a loop 2017-03-02 23:58:29 -05:00
Seth M. Larson 604faba1db bpo-29704: Fix asyncio.SubprocessStreamProtocol closing (#405) 2017-03-02 23:31:17 -05:00
Yury Selivanov 13802a3b11 bpo-29271: Fix Task.current_task and Task.all_tasks to accept None. (#406) 2017-03-02 23:19:49 -05:00
Yury Selivanov dea5101ae1 bpo-28893: Set __cause__ for errors in async iteration protocol (#407) 2017-03-02 22:28:07 -05:00
Yury Selivanov 01e5230ef0 bpo-29703: asyncio: Fix creating new event loops in child processes. (#404) (#410) 2017-03-02 22:06:15 -05:00
Xiang Zhang c4a786b8ad bpo-29661: fix contradiction in timeit.Timer.autorange's docstring (GH-331) (GH-353) 2017-02-28 11:28:44 +08:00
Berker Peksag bb59d89cee bpo-27788 : synchronise platform.py version number (#246) (#341)
Was bumped in the docstring by b9f4feab1b
but not in `__version__`

(cherry picked from commit 6059ce45aa)
2017-02-27 19:14:11 +03:00
Martijn Pieters 53039ad381 bpo-28598: Support __rmod__ for RHS subclasses of str in % string formatting operations (#95) 2017-02-27 19:08:01 +03:00
Xiang Zhang 4b6c41768a bpo-29376: Fix assertion error in threading._DummyThread.is_alive() (GH-330) 2017-02-27 11:45:42 +08:00
INADA Naoki c9131b61fa [3.6] bpo-29110: Fix file object leak in `aifc.open` (#310)
(cherry picked from commit 03f68b60e1) (GH-162)
(cherry picked from commit 5dc33eea53) (GH-293)
2017-02-27 04:09:32 +09:00
Berker Peksag 6b81003bdb bpo-28624: Add a test that checks that cwd parameter of Popen() accepts PathLike objects (#157) (#323)
(cherry picked from commit d5c11f7ace)
2017-02-26 20:38:31 +03:00
Berker Peksag 76995cab69 bpo-28518: Start a transaction implicitly before a DML statement (#245) (#318)
Patch by Aviv Palivoda.

(cherry picked from commit 4a926caf8e)
2017-02-26 19:09:10 +03:00
Berker Peksag fae59e1aa8 bpo-28961: Address my comments from earlier code review (#306)
(cherry picked from commit dea1536fd3)
2017-02-26 16:05:30 +03:00
Mariatta bea9d2f648 [3.6] bpo-28556: Update to typing: treat subscripted generics as proxies (GH-265) (GH-268)
(cherry picked from commit abb3b8ad94)
(cherry picked from commit 365cb5bb90)
2017-02-24 16:40:50 -08:00
Arne de Laat 55b82e10dc bpo-28911: Clarify the behaviour of assert_called_once_with. (#252)
(cherry picked from commit 9d56b34af2)
2017-02-23 16:17:11 +01:00
Vinay Sajip 3cc5817cfa Fixed bpo-29565: Corrected ctypes passing of large structs by value on Windows AMD64. (#168) (#220)
Fixed bpo-29565: Corrected ctypes passing of large structs by value.
(cherry picked from commit a86339b83f)
2017-02-22 06:21:17 +00:00
Berker Peksag b067a5eef7 bpo-29554: Improve docs for pstat module and profile. (#88) (#227)
Clarify that methods take a string which is interpreted as a regex,
not a regex object.

Also clarify what the old `-1`, `0`, `1` and `2` options were.

(cherry picked from commit 8fb1f6e039)
2017-02-22 04:55:33 +03:00
Serhiy Storchaka e48fd93bbb bpo-29532: Altering a kwarg dictionary passed to functools.partial() no longer affects a partial object after creation. (#209) 2017-02-21 18:18:27 +02:00
Mark Dickinson d9b3cdd137 bpo-29602: fix signed zero handling in complex constructor. (#203) (#206)
* Fix incorrect handling of signed zeros for complex-related classes.

* Add Misc/NEWS entry.

(cherry picked from commit 112ec38c15)
2017-02-20 21:59:30 +00:00
Senthil Kumaran a4afdfcf27 Change some mercurial/ hg.python.org references. (#8) (#185)
(cherry picked from commit b2ee40ed9c)
2017-02-19 18:58:33 -08:00
Nick Coghlan 0683d6889b [3.6] bpo-29571: Use correct locale encoding in test_re (#149) (#153)
``local.getlocale(locale.LC_CTYPE)`` and
``locale.getpreferredencoding(False)`` may give different answers
in some cases (such as the ``en_IN`` locale).

``re.LOCALE`` uses the latter, so update the test case to match.
2017-02-19 10:03:35 +05:30
Mariatta 0230e64d2c bpo-28556: Various updates to typing (#28) (#77)
various updates from upstream python/typing repo:

- Added typing.Counter and typing.ChainMap generics
- More flexible typing.NamedTuple
- Improved generic ABC caching
- More tests
- Bugfixes
- Other updates
* Add Misc/NEWS entry


(cherry picked from commit b692dc8475)
2017-02-14 06:11:12 -08:00
Berker Peksag 89b1824e69 bpo-27122: Fix comment to point to correct issue number (#48)
It took me quite a bit to figure out what this was referring to,
since the given issue number is wrong, and the original commit
message I found through git blame lists a different, also wrong
issue number... see https://bugs.python.org/issue27122#msg279449

(cherry picked from commit af88e7eda4)
2017-02-12 19:13:31 +03:00
Victor Stinner 2a35c939cc Fix test_datetime on Windows
Issue #29100: On Windows, datetime.datetime.fromtimestamp(min_ts) fails with an
OSError in test_timestamp_limits().
2017-02-10 12:37:21 +01:00
Victor Stinner 6f37e3645d Fix test_datetime on system with 32-bit time_t
Issue #29100: Catch OverflowError in the new test_timestamp_limits() test.
2017-02-10 11:45:14 +01:00
Victor Stinner b67f096738 Fix datetime.fromtimestamp(): check bounds
Issue #29100: Fix datetime.fromtimestamp() regression introduced in Python
3.6.0: check minimum and maximum years.
2017-02-10 10:34:02 +01:00
Łukasz Langa 57fe245e8c Merge 3.5 (fix #29519) 2017-02-10 00:16:10 -08:00
Łukasz Langa 9cd7e17640 Fix #29519: weakref spewing exceptions during interp finalization 2017-02-10 00:14:55 -08:00
Mariatta Wijaya 6138432e59 Issue #29314: Merge with 3.5 2017-02-06 22:05:10 -08:00
Mariatta Wijaya 4e7ff8b1a3 Issue #29314: Set the stacklevel to two in asyncio.async() Deprecation Warning 2017-02-06 22:03:00 -08:00
Steve Dower 2dfa6cb9ff Issue #28164: Improves test on Windows 7 2017-02-06 14:50:17 -08:00
Steve Dower 0c8ee60e91 Updates test_winconsoleio to better show the source of its issues. 2017-02-04 16:46:34 -08:00
Steve Dower 5f9193a6ed Issue #29326: Ignores blank lines in ._pth files (Patch by Alexey Izbyshev) 2017-02-04 15:19:29 -08:00
Steve Dower 722e3e2705 Issue #28164: Correctly handle special console filenames (patch by Eryk Sun) 2017-02-04 15:07:46 -08:00
Steve Dower d3c4853b78 Issue #29416: Prevent infinite loop in pathlib.Path.mkdir 2017-02-04 14:54:56 -08:00
Steve Dower eacee98679 Issue #29409: Implement PEP 529 for io.FileIO (Patch by Eryk Sun) 2017-02-04 14:38:11 -08:00
Steve Dower 1add96f1b6 Issue #29416: Prevent infinite loop in pathlib.Path.mkdir 2017-02-04 14:55:16 -08:00
Serhiy Storchaka 86e42376c2 Issue #29444: Fixed out-of-bounds buffer access in the group() method of
the match object.  Based on patch by WGH.
2017-02-04 22:55:40 +02:00
Serhiy Storchaka 7e10dbbd45 Issue #29444: Fixed out-of-bounds buffer access in the group() method of
the match object.  Based on patch by WGH.
2017-02-04 22:53:57 +02:00
Vinay Sajip 3746619b84 Fixes #29213: merged fix from 3.5. 2017-02-02 19:26:48 +00:00
Vinay Sajip db38b6c9a9 Fixes #29213: regularised EOLs of venv scripts. 2017-02-02 19:25:24 +00:00
Vinay Sajip 993f535ae9 Fixes #24875: Merged fix from 3.5. 2017-02-02 19:17:02 +00:00
Vinay Sajip db6322cb8a Fixes #24875: pip can now be installed in a venv with --system-site-packages. 2017-02-02 19:05:19 +00:00
Victor Stinner 64e91275e3 Merge 3.5 2017-02-02 14:18:43 +01:00
Victor Stinner a5917d1d15 Issue #29300: test_struct tests unpack_from() with keywords
Add an unit test on the _struct.Struct.unpack_from() method to test passing
arguments as keywords.
2017-02-02 14:18:18 +01:00
Berker Peksag 236fc60986 Issue #29283: Delete accidentally added Lib/site-packages/README
It was renamed to README.txt in d90a65014c42 and it was
back by a merge commit accidentally.
2017-01-30 13:55:49 +03:00
Vinay Sajip dbb5686e7e Fixes #29308: Merged fix from 3.5. 2017-01-27 12:42:45 +00:00
Vinay Sajip 3ac504289a Fixes #29308: Respect VIRTUAL_ENV_DISABLE_PROMPT in Activate.ps1. 2017-01-27 12:41:27 +00:00
Ethan Furman 28cf663ff0 closes issue29167: fix race condition in (Int)Flag 2017-01-24 12:12:06 -08:00
Serhiy Storchaka 4102d25b7e Issue #29337: Fixed possible BytesWarning when compare the code objects.
Warnings could be emitted at compile time.
2017-01-24 20:52:43 +02:00
Serhiy Storchaka 713640c4c9 Issue #29337: Fixed possible BytesWarning when compare the code objects.
Warnings could be emitted at compile time.
2017-01-24 20:49:26 +02:00
Martin Panter 9cf20a664c Issues #29273: Merge test___all__ from 3.5 2017-01-23 22:59:03 +00:00
Martin Panter b1b985da12 Issue #29273: Remove unneeded workaround to restore locale
The “readline” module already has a workaround using setlocale(LC_CTYPE,
NULL). The code in test___all__ calls getlocale(), which can subtly alter
the locale string and cause the test framework to complain.
2017-01-23 22:11:09 +00:00
Gregory P. Smith 9358a6e62b Skip the test requiring ctypes if ctypes is unavailable.
prevents http://buildbot.python.org/all/builders/x86%20Ubuntu%20Shared%203.x/builds/240/steps/test/logs/stdio
2017-01-22 22:19:51 -08:00
Gregory P. Smith 1fa08bcbbb Skip the test requiring ctypes if ctypes is unavailable.
prevents http://buildbot.python.org/all/builders/x86%20Ubuntu%20Shared%203.x/builds/240/steps/test/logs/stdio
2017-01-22 22:19:38 -08:00
Gregory P. Smith 21a9b1dfc6 typo fix, extra '.' on MacOS :) 2017-01-22 20:55:02 -08:00
Gregory P. Smith 21d333b703 typo fix, extra '.' :) 2017-01-22 20:54:42 -08:00
Guido van Rossum 744cd63df9 Issue #28556: Allow defining methods in NamedTuple class syntax (#362) (3.5->3.6) 2017-01-22 17:47:21 -08:00
Guido van Rossum 95919c096c Issue #28556: Allow defining methods in NamedTuple class syntax (#362) 2017-01-22 17:47:20 -08:00
Guido van Rossum 0c5f47fbf4 Issue #28556: various style fixes for typing.py (3.5->3.6) 2017-01-22 17:43:56 -08:00
Guido van Rossum d7adfe129c Issue #28556: various style fixes for typing.py 2017-01-22 17:43:53 -08:00
Gregory P. Smith 78034c81fb Issue #29335: Fix subprocess.Popen.wait() when the child process has
exited to a stopped instead of terminated state (ex: when under ptrace).
2017-01-22 17:29:44 -08:00
Gregory P. Smith 50e16e33af Issue #29335: Fix subprocess.Popen.wait() when the child process has
exited to a stopped instead of terminated state (ex: when under ptrace).
2017-01-22 17:28:38 -08:00
Xiang Zhang b1681189af Issue #29290: Merge 3.5. 2017-01-22 14:39:20 +08:00
Xiang Zhang 7fe28ad837 Issue #29290: argparse help messages won't wrap at non-breaking spaces. 2017-01-22 14:37:22 +08:00
Serhiy Storchaka a203360836 Issue #28735: Fixed the comparison of mock.MagickMock with mock.ANY. 2017-01-21 23:15:18 +02:00
Serhiy Storchaka 362f058a89 Issue #28735: Fixed the comparison of mock.MagickMock with mock.ANY. 2017-01-21 23:12:58 +02:00
Serhiy Storchaka 398ef5c08f Issue #29327: Fixed a crash when pass the iterable keyword argument to sorted(). 2017-01-20 08:33:06 +02:00
Guido van Rossum 38a49bec7a Issue #29198: add AsyncGenerator (Jelle Zijlstra) (3.5->3.6) 2017-01-18 13:10:34 -08:00
Guido van Rossum e9ed560fce Issue #29198: add AsyncGenerator (Jelle Zijlstra) 2017-01-18 13:10:31 -08:00
Guido van Rossum 49f08a2c26 Issue #28556: allow default values in class form of NamedTuple -- Jelle Zijlstra (3.5->3.6) 2017-01-18 08:03:52 -08:00
Guido van Rossum 3c268be885 Issue #28556: allow default values in class form of NamedTuple -- Jelle Zijlstra 2017-01-18 08:03:50 -08:00
Martin Panter 4710935b11 Issue 29274: Merge doc fixes from 3.5 2017-01-18 12:11:12 +00:00
Martin Panter 37f183d43d Issue #29274: tests cases → test cases 2017-01-18 12:06:38 +00:00
Guido van Rossum 043a8bc72a Issue #28556: merge 5 more typing changes from upstream (#340, #344, #348, #349, #350) (3.5->3.6) 2017-01-17 20:43:30 -08:00