Commit Graph

41652 Commits

Author SHA1 Message Date
Miss Islington (bot) f37dd11f0d [3.6] bpo-31293: Fix crashes in truediv and mul of a timedelta by a float with a bad as_integer_ratio() method. (GH-3227) (#3654)
(cherry picked from commit 865e4b4f63)
2017-09-19 17:00:44 +03:00
Miss Islington (bot) 99a51d4e5b [3.6] bpo-31315: Fix an assertion failure in imp.create_dynamic(), when spec.name is not a string. (GH-3257) (#3653)
(cherry picked from commit 9974e1bcf3)
2017-09-19 15:51:19 +03:00
Ned Deily 2f61f6417a Update pydoc topics and NEWS blurbs for 3.6.3rc1 2017-09-18 23:04:41 -04:00
Miss Islington (bot) 8afd7ab12d [3.6] bpo-31499, xml.etree: Fix xmlparser_gc_clear() crash (GH-3641) (#3645)
* bpo-31499, xml.etree: Fix xmlparser_gc_clear() crash

xml.etree: xmlparser_gc_clear() now sets self.parser to NULL to prevent a
crash in xmlparser_dealloc() if xmlparser_gc_clear() was called previously
by the garbage collector, because the parser was part of a reference cycle.

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit e727d41ffc)
2017-09-18 05:48:23 -07:00
Miss Islington (bot) 84c89ef4e5 [3.6] bpo-30928: Update idlelib/NEWS.txt to 2017 Sep 17. (GH-3635) (#3637)
(cherry picked from commit 55679e0ec7)
2017-09-17 21:10:54 -04:00
Miss Islington (bot) 6b4d8ba097 [3.6] bpo-31502: IDLE Configdialog again deletes custom themes and keysets. (GH-3634) (#3636)
This reverses a never-released regression resulting from bpo-31287.
(cherry picked from commit 0efc7c67a2)
2017-09-17 20:39:24 -04:00
Miss Islington (bot) b417332bf4 [3.6] bpo-31493: Fix code context update and font update timers. (GH-3622) (#3623)
Canceling timers prevents a warning message when test_idle completes.
(This is the minimum fix needed before upcoming releases.)
(cherry picked from commit a6bb313c70)
2017-09-17 02:01:53 -04:00
Miss Islington (bot) 77b52e463a [3.6] bpo-31488: IDLE - update former extensions when options change. (GH-3612) (#3613)
When apply ConfigDialog changes, call .reload on each class with non-key options.
Change ParenMatch so that updates affect current instances.
(cherry picked from commit 5777ecc438)
2017-09-16 02:14:34 -04:00
Victor Stinner 2c1c2ca254 [3.6] bpo-31234: Join threads in tests (#3589)
* bpo-31234: Join threads in tests (#3572)

Call thread.join() on threads to prevent the "dangling threads"
warning.

(cherry picked from commit 18e95b4176)

* bpo-31234: Join threads in test_hashlib (#3573)

* bpo-31234: Join threads in test_hashlib

Use thread.join() to wait until the parallel hash tasks complete
rather than using events. Calling thread.join() prevent "dangling
thread" warnings.

* test_hashlib: minor PEP 8 coding style fixes

(cherry picked from commit 8dcf22f442)

* bpo-31234: Join threads in test_threading (#3579)

Call thread.join() to prevent the "dangling thread" warning.

(cherry picked from commit b8c7be2c52)

* bpo-31234: Join threads in test_queue (#3586)

Call thread.join() to prevent the "dangling thread" warning.

(cherry picked from commit 167cbde50a)

* bpo-31234: Join timers in test_threading (#3598)

Call the .join() method of threading.Timer timers to prevent the
"threading_cleanup() failed to cleanup 1 threads" warning.

(cherry picked from commit da3e5cf961)
2017-09-15 16:55:47 -07:00
Terry Jan Reedy 4d72945a28 [3.6] bpo-314777: IDLE - improve rstrip entry in doc (GH-3602) (#3605)
'Strip trailing whitespace' is not limited to spaces.  Wording caters to beginners who
do know know the meaning of 'whitespace'.  Multiline string literals are not skipped.
(cherry picked from commit ff70289)
2017-09-15 15:09:17 -04:00
Terry Jan Reedy 93d5f91fff [3.6] bpo-31462: IDLE - remove trailing whitespaces (GH-3564) (#3594)
Reproduction of Idlelib changes in Serhiy's 3.7 patch.
2017-09-14 22:52:16 -04:00
Miss Islington (bot) 7b62416d86 [3.6] bpo-31480: IDLE - fix tests to pass with zzdummy extension disabled. (GH-3590) (#3591)
Enabled by default was a temporary expedient.  The fix is to add a user override to enable.
(cherry picked from commit d384a81f55)
2017-09-14 20:34:42 -04:00
Miss Islington (bot) 49caab46f6 [3.6] bpo-31455: Fix an assertion failure in ElementTree.XMLParser(). (GH-3545) (#3585)
* Avoid calling "PyObject_GetAttrString()" (and potentially executing user code) with a live exception set.

* Ignore only AttributeError on attribute lookups in ElementTree.XMLParser() and propagate all other exceptions.
(cherry picked from commit c8d8e15bfc)
2017-09-15 02:13:21 +03:00
Miss Islington (bot) 1658ec0757 [3.6] bpo-28556: typing.get_type_hints: better globalns for classes and modules (GH-3582) (#3583)
This makes the default behavior (without specifying `globalns` manually) more
predictable for users, finds the right globalns automatically.

Implementation for classes assumes has a `__module__` attribute and that module
is present in `sys.modules`.  It does this recursively for all bases in the
MRO.  For modules, the implementation just uses their `__dict__` directly.

This is backwards compatible, will just raise fewer exceptions in naive user
code.

Originally implemented and reviewed at https://github.com/python/typing/pull/470.
(cherry picked from commit f350a268a7)
2017-09-14 16:52:05 -04:00
Miss Islington (bot) f135f62cfd [3.6] bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (GH-3580) (#3584)
(cherry picked from commit 0b3a87ef54)
2017-09-14 22:56:31 +03:00
Miss Islington (bot) 20fa05d022 [3.6] bpo-31457: Allow for nested LoggerAdapter objects (GH-3551) (#3576)
Some of the proxied methods use internal Logger state which isn't proxied,
causing failures if an adapter is applied to another adapter.

This commit fixes the issue, adds a new test for the use case.
(cherry picked from commit 1bbd482bcf)
2017-09-14 13:10:25 -04:00
Miss Islington (bot) 9e3cd78ec1 [3.6] bpo-28556: Minor updates to typing module (GH-3550) (#3558)
* Copy changes to typing from upstream repo
* Add NEWS entry
(cherry picked from commit 65bc62052f)
2017-09-13 20:10:53 -04:00
Victor Stinner ef323e8d82 [3.6] bpo-31234: Fix dangling thread in test_ftp/poplib (#3554)
* bpo-31234: Fix dangling thread in test_ftp/poplib (#3540)

Explicitly clear the server attribute in test_ftplib and test_poplib
to prevent dangling thread.

(cherry picked from commit d403a29c00)

* bpo-31234: Fix dangling thread in test_ftplib (#3544)

Clear also self.server_thread attribute in TestTimeouts.tearDown().

(cherry picked from commit b157ce1e58)
2017-09-13 15:56:14 -07:00
Miss Islington (bot) d99e85b9f6 [3.6] bpo-31234, socket.create_connection(): Fix ref cycle (GH-3546) (#3552)
(cherry picked from commit acb9fa79fa)
2017-09-13 15:54:34 -07:00
Miss Islington (bot) 769ddb075a [3.6] bpo-31448, test_poplib: Fix ResourceWarning (GH-3542) (#3543)
Call POP3.close(), don't close close directly the sock attribute.
(cherry picked from commit d165e14e29)
2017-09-13 06:09:44 -07:00
Miss Islington (bot) 6c25b73194 [3.6] bpo-31234: test_httpservers joins the server thread (GH-3188) (#3536)
(cherry picked from commit 830d7d2936)
2017-09-13 03:27:54 -07:00
Miss Islington (bot) 89bfc9b0d9 [3.6] bpo-31234: test_threaded_import: fix test_side_effect_import() (GH-3189) (#3537)
* Don't leak the module into sys.modules
* Avoid dangling thread
(cherry picked from commit 41bbd82b6b)
2017-09-13 03:27:45 -07:00
Miss Islington (bot) 1b00bddd5c [3.6] bpo-31323: Fix reference leak in test_ssl (GH-3263) (#3538)
Store exceptions as string rather than object to prevent reference
cycles which cause leaking dangling threads.
(cherry picked from commit 8687101589)
2017-09-13 03:27:34 -07:00
Miss Islington (bot) 94eb2d5b73 [3.6] bpo-31249: Fix test_concurrent_futures dangling thread (GH-3521) (#3522)
ProcessPoolShutdownTest.test_del_shutdown() now closes the call queue
and joins its thread, to prevent leaking a dangling thread.
(cherry picked from commit 3bcf157c11)
2017-09-12 17:43:44 -07:00
Miss Islington (bot) bcf042ff98 [3.6] bpo-31234: Enhance test_thread.test_forkinthread() (GH-3516) (#3519)
* test_thread.test_forkinthread() now waits until the thread completes.
* Check the status in the test method, not in the thread function
* Don't ignore RuntimeError anymore: since the commit
  346cbd351e (bpo-16500,
  os.register_at_fork(), os.fork() cannot fail anymore with
  RuntimeError.
* Replace 0.01 literal with a new POLL_SLEEP constant
* test_forkinthread(): test if os.fork() exists rather than testing
  the platform.
(cherry picked from commit a15d155aad)
2017-09-12 16:14:09 -07:00
Victor Stinner 5013a5ebc9 [3.6] bpo-31250: test_asyncio: fix dangling threads (#3517)
* bpo-31250, test_asyncio: fix dangling threads (#3252)

* Explicitly call shutdown(wait=True) on executors to wait until all
  threads complete to prevent side effects between tests.
* Fix test_loop_self_reading_exception(): don't mock loop.close().
  Previously, the original close() method was called rather than the
  mock, because how set_event_loop() registered loop.close().

(cherry picked from commit 16432beadb)

* bpo-31250, test_asyncio: fix EventLoopTestsMixin.tearDown() (#3264)

Call doCleanups() to close the loop after calling
executor.shutdown(wait=True): see TestCase.set_event_loop() of
asyncio.test_utils.

Replace also gc.collect() with support.gc_collect().

(cherry picked from commit e8a533fbc7)
2017-09-12 14:18:23 -07:00
Miss Islington (bot) 4d7807ab9a [3.6] bpo-31421: Document how IDLE runs tkinter programs. (GH-3513) (#3514)
IDLE calls tcl/tk update in the background in order to make live
interaction and experimentatin with tkinter applications much easier.
(cherry picked from commit 98758bc67f)
2017-09-12 09:44:59 -04:00
Miss Islington (bot) 01dcaa5c99 [3.6] bpo-27099: Finish updating IDLE doc and help text. (GH-3510) (#3511)
As needed for the conversion of extensions to features.
(cherry picked from commit adb4cd2a2a)
2017-09-12 08:23:38 -04:00
Serhiy Storchaka 9adc87b0f8 [3.6] bpo-31416: Fix assertion failures in case of a bad warnings.filters or warnings.defaultaction. (GH-3496) (#3509)
Patch by Oren Milman..
(cherry picked from commit 9d984fd2b0)
2017-09-12 09:48:27 +03:00
Benjamin Peterson cb356c2ecc [3.6] bpo-31373: remove overly strict float range checks (GH-3486) (#3495)
This undoes a853a8ba78 except for the pytime.c
parts. We want to continue to allow IEEE 754 doubles larger than FLT_MAX to be
rounded into finite floats. Tests were added to very this behavior.
(cherry picked from commit 2bb69a5b4e)
2017-09-11 23:08:49 -07:00
Miss Islington (bot) 99b941b420 [3.6] bpo-30928: Update idlelib/NEWS.txt to 2017-09-11. (GH-3503) (#3504)
(cherry picked from commit 8239fd7046)
2017-09-11 17:50:40 -04:00
Miss Islington (bot) 31b242459c [3.6] bpo-31414: IDLE -- fix tk entry box tests by deleting first. (GH-3501) (#3502)
Adding to an int entry is not the same as deleting and inserting
because int('') will fail.
(cherry picked from commit 667522efa8)
2017-09-11 16:34:11 -04:00
Serhiy Storchaka 7972ed2111 [3.6] bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (GH-3485). (#3494)
(cherry picked from commit 252033d50e)
2017-09-11 10:01:47 +03:00
Miss Islington (bot) 4a8b53a208 [3.6] bpo-30781: IDLE: Fix help button on configdialog (GH-3238) (#3489)
This fixes an omission in the ttk conversion patch for this issue, hence no new news.
Patch by Cheryl Sabella.
(cherry picked from commit 3866d9bbcf)
2017-09-10 23:19:35 -04:00
Henk-Jaap Wagenaar 2a0f7c34c3 Backport docstring improvements to OrderedDict. (GH-3470) 2017-09-10 18:11:18 -07:00
Terry Jan Reedy d6c397bf77 [3.6] bpo-27099: IDLE - Convert built-in extensions to regular features (GH-2494) (#3487)
About 10 IDLE features were implemented as supposedly optional
extensions.  Their different behavior could be confusing or worse for
users and not good for maintenance.  Hence the conversion.

The main difference for users is that user configurable key bindings
for builtin features are now handled uniformly.  Now, editing a binding
in a keyset only affects its value in the keyset.  All bindings are
defined together in the system-specific default keysets in config-
extensions.def.  All custom keysets are saved as a whole in config-
extension.cfg.  All take effect as soon as one clicks Apply or Ok.

The affected events are '<<force-open-completions>>', '<<expand-word>>',
'<<force-open-calltip>>', '<<flash-paren>>', '<<format-paragraph>>',
'<<run-module>>', '<<check-module>>', and '<<zoom-height>>'.  Any
(global) customizations made before 3.6.3 will not affect their keyset-
specific customization after 3.6.3. and vice versa.

Inital patch by Charles Wohlganger, revised by Terry Jan Reedy.
(cherry picked from commit 58fc71c)
2017-09-10 20:30:46 -04:00
Miss Islington (bot) a4baf1c543 [3.6] bpo-26669: Fix nan arg value error in pytime.c (GH-3085) (GH-3467)
* Modify NaN check function and error message
* Fix pytime.c when arg is nan
* fix whitespace
(cherry picked from commit 829dacce4f)
2017-09-08 21:53:04 -07:00
Miss Islington (bot) 3892799668 [3.6] bpo-30822: Deduplicate ZoneInfoTest classes in test_datetime. (GH-2534) (#3405)
(cherry picked from commit 34b54873b5)
2017-09-08 15:44:33 -07:00
Christian Heimes 9f2b3d4c28 [3.6] bpo-29136: Add TLS 1.3 cipher suites and OP_NO_TLSv1_3 (GH-1363) (#3444)
* bpo-29136: Add TLS 1.3 support

TLS 1.3 introduces a new, distinct set of cipher suites. The TLS 1.3
cipher suites don't overlap with cipher suites from TLS 1.2 and earlier.
Since Python sets its own set of permitted ciphers, TLS 1.3 handshake
will fail as soon as OpenSSL 1.1.1 is released. Let's enable the common
AES-GCM and ChaCha20 suites.

Additionally the flag OP_NO_TLSv1_3 is added. It defaults to 0 (no op) with
OpenSSL prior to 1.1.1. This allows applications to opt-out from TLS 1.3
now.

Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit cb5b68abde)
2017-09-07 20:23:52 -07:00
Christian Heimes 9423f5d688 [3.6] bpo-27340: Use memoryview in SSLSocket.sendall() (GH-3384) (#3434)
* bpo-27340: Use memoryview in SSLSocket.sendall()

SSLSocket.sendall() now uses memoryview to create slices of data. This fix
support for all bytes-like object. It is also more efficient and avoids
costly copies.

Signed-off-by: Christian Heimes <christian@python.org>

* Cast view to bytes, fix typo

Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 888bbdc192)
2017-09-07 16:59:17 -07:00
Miss Islington (bot) fb4c28c032 [3.6] bpo-22635: Update the getstatusoutput docstring. (GH-3435) (#3439)
To match the documentation updates already made.
Also renames the local variable used within to match
what it actually holds.
(cherry picked from commit 2eb0cb4787)
2017-09-07 16:44:58 -07:00
Steve Dower 76006f285a [3.6] bpo-30389 Adds detection of VS 2017 to distutils._msvccompiler GH-1632 (#3425) 2017-09-07 13:58:07 -07:00
Miss Islington (bot) aa1afc72c1 bpo-30465: Fix lineno and col_offset in fstring AST nodes (GH-1800) (gh-3409)
For f-string ast nodes, fix the line and columns so that tools such as flake8 can identify them correctly.
(cherry picked from commit e7c566caf1)
2017-09-06 19:43:04 -07:00
Miss Islington (bot) e29ab7e751 [3.6] bpo-30824: Add mimetype for .json (GH-3048) (#3401)
(cherry picked from commit 8204b90368)
2017-09-06 20:04:14 -04:00
Steve Dower fd645ec6f5 [3.6] bpo-31340: Change to building with MSVC v141 (included with Visual Studio 2017) (GH-3311) (#3386) 2017-09-06 15:55:25 -07:00
Gregory P. Smith 3bad1650a0 [3.6] bpo-31178: Avoid concatenating bytes with str in subprocess error (GH-3066) (#3388)
Avoid concatenating bytes with str in the typically rare subprocess error path (exec failed). Includes a mock based unittest to exercise the codepath.
(cherry picked from commit 3fc499bca1)
2017-09-06 13:34:17 -07:00
Miss Islington (bot) 3aea3c298b [3.6] Stop test_xmlrpc from writing to sys.stderr (GH-3359) (#3380)
One test case of test_xmlrpc uses HTTPServer with a subclass of
BaseHTTPRequestHandler. The BaseRequestHandler class logs to
sys.stderr by default. Override log_message() to not clobber
test output.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 3463ee3972)
2017-09-06 10:22:14 -07:00
Christian Heimes 6da379bde3 [3.6] bpo-29781: Fix SSLObject.version before handshake (GH-3364) (#3381)
SSLObject.version() now correctly returns None when handshake over BIO has
not been performed yet.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 6877111)
2017-09-06 06:42:30 -07:00
Miss Islington (bot) ff125e1aa9 bpo-31350: Optimize get_event_loop and _get_running_loop (GH-3347) (GH-3373)
* call remove_done_callback in finally section

* Optimize get_event_loop and _get_running_loop

* rename _loop_pid as loop_pid and add blurb news

* rename _loop_pid as loop_pid and add blurb news

* add back _RunningLoop

* Update 2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst

* Update 2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst
(cherry picked from commit 80bbe6a7b6)
2017-09-05 20:05:35 -07:00
Mariatta 3b9d4444fe [3.6] bpo-30662: fixed OrderedDict.__init__ docstring re PEP 468 (GH-2179) (GH-3370)
* fixed OrderedDict.__init__ docstring re PEP 468

* tightened comment and mirrored to C impl

* added space after period per marco-buttu

* preserved substituted for stable

* drop references to Python 3.6 and PEP 468
(cherry picked from commit faa57cbe70)
2017-09-05 18:13:07 -07:00
Miss Islington (bot) c506403faf [3.6] bpo-31320: No traceback to sys.stderr in test_ssl (GH-3360) (GH-3369)
In case PROTOCOL_TLS_SERVER is used for both client context and server
context, the test thread dies with OSError. Catch OSError to avoid
traceback on sys.stderr

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 305e56c27a)
2017-09-05 18:11:31 -07:00
Victor Stinner 9a3b3852af bpo-30442: Skips refcount test in test_xml_etree under coverage (#1767) (#3363)
(cherry picked from commit 1de4705d00)
2017-09-06 02:10:08 +02:00
Victor Stinner 6fce7ea893 bpo-30445: Allow appended output in RecursionError message (#3356)
Running under coverage sometimes causes 'in comparison' to be added to the end of the RecursionError message, which is acceptable.

Patched by Maria Mckinley

(cherry picked from commit 3480ef9dd3)
2017-09-06 01:07:44 +02:00
Gregory P. Smith 1dba3789e3 bpo-22536 [3.6] Set filename in FileNotFoundError (#3305)
* [3.6] bpo-22536: Set the filename in FileNotFoundError. (GH-3194)

Have the subprocess module set the filename in the FileNotFoundError
exception raised on POSIX systems when the executable or cwd are missing.
(cherry picked from commit 8621bb5d93)

* bpo-22536 [3.6] (GH-3202) skip non-windows tests.
2017-09-04 14:23:23 -07:00
Christian Heimes 4bc8ef0eee [3.6] bpo-25674: remove sha256.tbs-internet.com ssl test (GH-3297) (#3300)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 002d64039b)
2017-09-04 22:54:47 +02:00
Gregory P. Smith 7d8282d25d [3.6] bpo-29212: Fix the ugly repr() ThreadPoolExecutor thread name. (GH-2315) (#3276)
bpo-29212: Fix the ugly ThreadPoolExecutor thread name.

Fixes the newly introduced ugly default thread name for concurrent.futures
thread.ThreadPoolExecutor threads.  They'll now resemble the old <=3.5
threading default Thread-x names by being named ThreadPoolExecutor-y_n..
(cherry picked from commit a3d91b43c2)
2017-09-03 14:52:20 -07:00
Antoine Pitrou 5cbca0235b [3.6] Fix a c.f.as_completed() refleak previously introduced in bpo-27144 (GH-3270) (#3271)
(cherry picked from commit 2ef3760)
2017-09-03 15:30:55 +02:00
Serhiy Storchaka 98bbeb78e0 bpo-31185: Fixed miscellaneous errors in asyncio speedup module. (#3076) (#3269)
(cherry picked from commit bca4939d80)
2017-09-03 09:24:32 +03:00
Antoine Pitrou ea767915f7 [3.6] bpo-27144: concurrent.futures as_complete and map iterators do not keep reference to returned object (GH-1560) (#3266)
bpo-27144: concurrent.futures as_complie and map iterators do not keep
reference to returned object

(cherry picked from commit 97e1b1c814)
2017-09-01 19:16:46 +02:00
Victor Stinner 98c849a2f3 bpo-31217: Fix regrtest -R for small integer (#3260) (#3261)
Use a pool of integer objects toprevent false alarm when checking for
memory block leaks. Fill the pool with values in -1000..1000 which
are the most common (reference, memory block, file descriptor)
differences.

Co-Authored-By: Antoine Pitrou <pitrou@free.fr>
(cherry picked from commit 6c2feabc5d)
2017-09-01 15:04:47 +02:00
Victor Stinner 60f3f1fb5c bpo-31249: Fix ref cycle in ThreadPoolExecutor (#3253)
[3.6] bpo-31249: Fix ref cycle in ThreadPoolExecutor
2017-09-01 14:46:44 +02:00
Oren Milman 095a421b16 [3.6] bpo-31291: Fixed an assertion failure in zipimport.zipimporter.get_data() (GH-3226) (#3243)
if pathname.replace('/', '\\') returns non-string.
(cherry picked from commit 631fdee6e6)
2017-08-30 14:08:39 +03:00
Pauli Virtanen 2d1653aa43 [3.6] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (GH-31) (#3241)
Ctypes currently produces wrong pep3118 type codes for several types.
E.g. memoryview(ctypes.c_long()).format gives "<l" on 64-bit platforms,
but it should be "<q" instead for sizeof(c_long) == 8

The problem is that the '<>' endian specification in the struct syntax
also turns on the "standard size" mode, which makes type characters have
a platform-independent meaning, which does not match with the codes used
internally in ctypes.  The struct module format syntax also does not
allow specifying native-size non-native-endian items.

This commit adds a converter function that maps the internal ctypes
codes to appropriate struct module standard-size codes in the pep3118
format strings. The tests are modified to check for this.
(cherry picked from commit 07f1658aa0)
2017-08-30 11:40:05 +02:00
Terry Jan Reedy 87c50245b1 [3.6] bpo-31051: Rearrange IDLE condigdialog GenPage into Window, Editor, and Help sections. (GH-3239) (#3240)
(cherry picked from commit 390ead)
2017-08-30 02:47:24 -04:00
Oren Milman c7750c2a3a [3.6] bpo-31243: Fixed PyArg_ParseTuple failure checks. (GH-3171) (#3233)
(cherry picked from commit ba7d736521)
2017-08-29 15:43:32 +03:00
Terry Jan Reedy 5c89c2fd8a [3.6] bpo-30617: IDLE: docstrings and unittest for outwin.py (GH-2046) (#3223)
Move some data and functions from the class to module level. Patch by Cheryl Sabella.
(cherry picked from commit 998f496)
2017-08-27 18:29:24 -04:00
Terry Jan Reedy 7e248904cd [3.6] bpo-31287: IDLE - do not alter tkinter.messagebox in configdialog tests. (GH-3220) (#3221)
(cherry picked from commit 3457f42)
2017-08-27 17:14:19 -04:00
Terry Jan Reedy 7b556025ff [3.6] bpo-30781: IDLE - use ttk widgets in configdialog (GH-2654) (#3214)
Patch by Cheryl Sabella.
(cherry picked from commit 7028e59)
2017-08-26 16:12:14 -04:00
Oren Milman 9bcbc6cba3 [3.6] bpo-31271: Fix an assertion failure in io.TextIOWrapper.write. (GH-3201) (#3209)
(cherry picked from commit a5b4ea15b6)
2017-08-26 20:29:40 +03:00
Oren Milman 8e67981fc8 [3.6] bpo-28261: Prevent raising SystemError where PyArg_ParseTuple is used to parse non-args. (#3210) 2017-08-26 15:27:50 +03:00
Martijn Pieters 680f04a926 bpo-31161: only check for parens error for SyntaxError (#3083)
Subclasses such as IndentError and TabError should not have this message
applied.
2017-08-22 13:11:09 -07:00
Victor Stinner 468534d92f bpo-31259: test_urllib2_localnet uses addCleanup(server.stop) (#3186)
Use self.addCleanup(self.server.stop) to stop the HTTP server. Some
tests didn't stop the server like test_https().

Fix also the usage of support.threading_cleanup().
2017-08-22 18:03:38 +02:00
Victor Stinner 5f20539ee5 bpo-31234: fork_wait tests now join threads (#3139) (#3187)
fork_wait.py tests now joins threads, to not leak running threads in
the background.

(cherry picked from commit c99d41f9c0)
2017-08-22 18:03:03 +02:00
Victor Stinner 29d007bb67 [3.6] bpo-30871: Add test.pythoninfo (#3174)
* bpo-30871: Add test.pythoninfo (#3075)

* Add Lib/test/pythoninfo.py: script collecting various informations
  about Python to help debugging test failures.
* regrtest: remove sys.hash_info and sys.flags from header.
* Travis CI, Appveyor: run pythoninfo before tests
(cherry picked from commit b907abc885)

* bpo-30871: pythoninfo: add expat and _decimal (#3121)

* bpo-30871: pythoninfo: add expat and _decimal

* Remove _decimal.__version__

The string is hardcoded, not really interesting.

(cherry picked from commit f6ebd838f0)

* bpo-30871: Add "make pythoninfo" (#3120)

(cherry picked from commit a3a01a2fce)

* bpo-30871: pythoninfo: more sys, os, time data (#3130)

* bpo-30871: pythoninfo: more sys, os, time data

PythonInfo now converts types other than intger to string by default.

* fix typo

(cherry picked from commit ad7eaed543)

* bpo-31231: Fix pythoninfo in Travis config (#3134)

bpo-31231, bpo-30871: Replace "./python -m test.pythoninfo" with
"make pythoninfo", since macOS uses ./python.exe.
(cherry picked from commit 92b1f90143)
2017-08-22 00:17:15 +02:00
Victor Stinner e76cb43556 [3.6] bpo-30121: Fix debug assert in subprocess on Windows (#1224) (#3173)
* bpo-30121: Fix debug assert in subprocess on Windows (#1224)

* bpo-30121: Fix debug assert in subprocess on Windows

This is caused by closing HANDLEs using os.close which is for CRT file
descriptors and not for HANDLEs.

* bpo-30121: Suppress debug assertion in test_subprocess when ran directly

(cherry picked from commit 4d3851727f)

* Add test_subprocess.test_nonexisting_with_pipes() (#3133)

bpo-30121: Test the Popen failure when Popen was created with pipes.
Create also NONEXISTING_CMD variable in test_subprocess.py.
(cherry picked from commit 9a83f651f3)
2017-08-22 00:15:23 +02:00
Victor Stinner 12a3e343e1 bpo-31247: xmlrpc.server: break reference cycle (#3166) (#3168)
xmlrpc.server now explicitly breaks reference cycles when using
sys.exc_info() in code handling exceptions.
(cherry picked from commit 84524454d0)
2017-08-21 18:35:04 +02:00
Cheryl Sabella 24c0c5b48c [3.6] bpo-31206: IDLE: Factor HighPage class from ConfigDialog (GH-3160) (#3162)
Part 3 of 3.  Remove old highlight functions and load_config as this functionality is now contained within classes. Patch by Cheryl Sabella.
(cherry picked from commit 4bfebc6301)
2017-08-20 19:21:51 -04:00
Cheryl Sabella 3d9c0d498d [3.6] bpo-31206: IDLE: Factor HighPage class from ConfigDialog (GH-3156) (#3159)
Patch 2 of 3, to avoid horrendous diff.  Create highlights page from new HighPage class instead of old ConfigDialog methods and change tests to match. Patch by Cheryl Sabella.
(cherry picked from commit 8f7a798edb)
2017-08-20 08:03:05 -04:00
Cheryl Sabella 764e282158 [3.6] bpo-31206: IDLE: Factor HighPage class from ConfigDialog (GH-3141) (#3154)
This is the first half of a patch similar to the one for for bpo-31205.  It is being split into 2 PRs to avoid what happened with PR-3096 -- an incomprehensible diff that could not be cleanly backported to 3.6.  This half copies several methods of ConfigDialog and turns them into a new class.  Patch by Cheryl Sabella.
(cherry picked from commit a32e40561a)
2017-08-19 09:22:54 -04:00
Nick Coghlan 1a05e87ec7 [3.6] bpo-31232: Backport custom print rshift message (GH-3155)
bpo-30721 added a "Did you mean ...?" suggestion to rshift
TypeError messages that triggers when the LHS is a Python
C function called "print".

Since this custom error message is expected to be triggered
primarily by attempts to use Python 2 print redirection syntax
in Python 3, and is incredibly unlikely to be encountered
otherwise, it is also being backported to the next 3.6
maintenance release.

Initial patch by Sanyam Khurana.
2017-08-19 16:59:38 +10:00
Victor Stinner b50e7683ac bpo-31234: test_threading: fix ref cycle (#3150) (#3152)
test_bare_raise_in_brand_new_thread() now explicitly breaks a
reference cycle to not leak a dangling thread.
(cherry picked from commit 3d284c081f)
2017-08-19 02:32:54 +02:00
Victor Stinner 3e866dfaec bpo-31235: Fix ResourceWarning in test_logging (#3147) (#3149)
(cherry picked from commit a7719e27b3)
2017-08-19 01:11:44 +02:00
Terry Jan Reedy 6db2edbe05 [3.6] bpo-31001: IDLE: Add tests for configdialog highlight tab (GH-3123) (#3124)
(cherry picked from commit 82aff62)
2017-08-17 21:02:20 -04:00
Victor Stinner 78c66a641a bpo-31069, test_multiprocessing: Fix dangling process (#3103) (#3104)
Fix a warning about dangling processes in test_rapid_restart() of
_test_multiprocessing: join the process.
(cherry picked from commit 17657bb945)
2017-08-16 13:14:38 +02:00
Terry Jan Reedy de36ba065e [3.6] bpo-30928: Update idlelib/NEWS.txt to 2017-08-15. (GH-3098) (#3099)
(cherry picked from commit 7f06684)
2017-08-15 19:41:03 -04:00
Terry Jan Reedy ff4b222b02 [3.6] bpo-31205: IDLE: Factor KeysPage class from ConfigDialog (GH-3096) (#3097)
* bpo-31205: IDLE: Factor KeysPage class from ConfigDialog (#3096)

  The slightly modified tests continue to pass.  Patch by Cheryl Sabella.

(cherry picked from commit e36d9f5568)

* [3.6] bpo-31205: IDLE: Factor KeysPage class from ConfigDialog (GH-3096)

  The slightly modified tests continue to pass.  Patch by Cheryl Sabella..
(cherry picked from commit e36d9f5568)
2017-08-15 19:13:11 -04:00
Christian Heimes 7f6a13bd56 [3.6] bpo-30714: ALPN changes for OpenSSL 1.1.0f (#3093)
OpenSSL 1.1.0 to 1.1.0e aborted the handshake when server and client
could not agree on a protocol using ALPN. OpenSSL 1.1.0f changed that.
The most recent version now behaves like OpenSSL 1.0.2 again. The ALPN
callback can pretend to not been set.

See https://github.com/openssl/openssl/pull/3158 for more details

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit a5c1bab352)
2017-08-15 10:45:40 +02:00
Terry Jan Reedy a31459008c [3.6] bpo-31002: IDLE: Add tests for configdialog keys tab (GH-2996) (#3092)
Patch by Cheryl Sabella.
(cherry picked from commit 2f89646)
2017-08-14 21:45:02 -04:00
Victor Stinner f2d769d539 bpo-31067: test_subprocess calls reap_children() (#2931) (#3074)
test_subprocess now also calls reap_children() in tearDown(), not
only on setUp().
(cherry picked from commit cc42c121eb)
2017-08-11 17:14:37 +02:00
Victor Stinner bc69d00288 bpo-31173: Rewrite WSTOPSIG test of test_subprocess (#3055) (#3070)
The current test_child_terminated_in_stopped_state() function test
creates a child process which calls ptrace(PTRACE_TRACEME, 0, 0) and
then crash (SIGSEGV). The problem is that calling os.waitpid() in the
parent process is not enough to close the process: the child process
remains alive and so the unit test leaks a child process in a
strange state. Closing the child process requires non-trivial code,
maybe platform specific.

Remove the functional test and replaces it with an unit test which
mocks os.waitpid() using a new _testcapi.W_STOPCODE() function to
test the WIFSTOPPED() path.
(cherry picked from commit 7b7c6dcfff)
2017-08-11 02:36:30 +02:00
Victor Stinner 270c3c62ed bpo-31008: Fix asyncio test_wait_for_handle on Windows (#3065) (#3068)
(cherry picked from commit 5659a72f48)
2017-08-11 01:52:13 +02:00
Victor Stinner 719a15b325 [3.6] bpo-31160: Backport reap_children() fixes from master to 3.6 (#3060)
* bpo-31160: Fix test_builtin for zombie process (#3043)

PtyTests.run_child() now calls os.waitpid() to read the exit status
of the child process to avoid creating zombie process and leaking
processes in the background.
(cherry picked from commit 4baca1b0f7)

* bpo-31160: regrtest now reaps child processes (#3044)

Add a post_test_cleanup() function which currently only calls
support.reap_children().
(cherry picked from commit e3510d74aa)

* bpo-31160: test_builtin: don't check waitpid() status (#3050)

(cherry picked from commit 3ca9f50f96)

* bpo-31160: test_tempfile: Fix reap_children() warning (#3056)

TestRandomNameSequence.test_process_awareness() now calls
os.waitpid() to avoid leaking a zombie process.
(cherry picked from commit 6c8c2943d9)
2017-08-10 16:02:00 +02:00
Terry Jan Reedy 646f6c3096 [3.6] bpo-19903: IDLE: Calltips changed to use inspect.signature (GH-2822) (#3053)
Idlelib.calltips.get_argspec now uses inspect.signature instead of inspect.getfullargspec, like help() does.  This improves the signature in the call tip in a few different cases, including builtins converted to provide a signature.  A message is added if the object is not callable, has an invalid signature, or if it has positional-only parameters.
Patch by Louie Lu..
(cherry picked from commit 3b0f620c1a)
2017-08-10 00:46:29 -04:00
Ammar Askar 4388b4257a [3.6] bpo-31150: Wait for child process in test_forkinthread to avoid thread reaped warnings (#3041) 2017-08-09 16:59:21 +02:00
Serhiy Storchaka f3b891718e [3.6] bpo-31070: Fix a race condition in importlib _get_module_lock(). (GH-3033). (#3038)
(cherry picked from commit 9b0d1d647e)
2017-08-09 14:56:13 +03:00
Victor Stinner 33460fa7e0 ttk: fix LabeledScale and OptionMenu destroy() method (#3025) (#3030)
bpo-31135: Call the parent destroy() method even if the used
attribute doesn't exist.

The LabeledScale.destroy() method now also explicitly clears label
and scale attributes to help the garbage collector to destroy all
widgets.
(cherry picked from commit cd7e9c1b67)
2017-08-09 10:48:11 +02:00
Terry Jan Reedy 9d7d928b58 [3.6] bpo-31130: IDLE -- stop leaks in test_configdialog. (GH-3016) (#3018)
Initial patch by Victor Stinner.
(cherry picked from commit 733d0f6)
2017-08-07 15:20:03 -04:00
Terry Jan Reedy b61de2d465 [3.6] bpo-29910: IDLE - revert `break`s that disabled calltip close. (GH-2997) (#3017)
(cherry picked from commit 8922587)
2017-08-07 14:23:07 -04:00
Rajath Agasthya 9cd0ef8f3b bpo-31029: test_tokenize Add missing import unittest (#2998) 2017-08-05 21:28:17 +03:00
Shane Harvey 4795ba857e [3.6] bpo-31107: Fix copyreg mangled slot names calculation. (GH-2989) (#3003)
(cherry picked from commit c4c9866064)
2017-08-05 18:01:10 +03:00
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