Commit graph

99992 commits

Author SHA1 Message Date
Serhiy Storchaka 5d84cb368c bpo-31464: asdl_c.py no longer emits trailing spaces in Python-ast.h. (#3568) 2017-09-14 20:28:22 -07:00
Barry Warsaw b2e5794870 bpo-31338 (#3374)
* Add Py_UNREACHABLE() as an alias to abort().
* Use Py_UNREACHABLE() instead of assert(0)
* Convert more unreachable code to use Py_UNREACHABLE()
* Document Py_UNREACHABLE() and a few other macros.
2017-09-14 18:13:16 -07:00
Terry Jan Reedy d384a81f55 bpo-31480: IDLE - fix tests to pass with zzdummy extension disabled. (#3590)
Enabled by default was a temporary expedient.  The fix is to add a user override to enable.
2017-09-14 18:51:51 -04:00
Feanil Patel 6a396c9807 bpo-31128: Allow pydoc to bind to arbitrary hostnames (#3011)
New -n flag allow overriding localhost with custom value,
for example to run from containers.
2017-09-14 17:54:09 -04:00
Victor Stinner ccb3c7654c bpo-30860: Fix deadcode in obmalloc.c (#3499)
Fix Coverity CID 1417587: _PyMem_Initialize() contains code which is
never executed.

Replace the runtime check with a build assertion.
2017-09-14 14:48:37 -07:00
Victor Stinner b9b69003d9 bpo-31234: Add support.join_thread() helper (#3587)
join_thread() joins a thread but raises an AssertionError if the
thread is still alive after timeout seconds.
2017-09-14 14:40:56 -07:00
Victor Stinner 167cbde50a bpo-31234: Join threads in test_queue (#3586)
Call thread.join() to prevent the "dangling thread" warning.
2017-09-14 14:04:56 -07:00
Victor Stinner ff40ecda73 bpo-31234: Add test.support.wait_threads_exit() (#3578)
Use _thread.count() to wait until threads exit. The new context
manager prevents the "dangling thread" warning.
2017-09-14 13:07:24 -07:00
Victor Stinner b8c7be2c52 bpo-31234: Join threads in test_threading (#3579)
Call thread.join() to prevent the "dangling thread" warning.
2017-09-14 13:05:21 -07:00
scoder c8d8e15bfc bpo-31455: Fix an assertion failure in ElementTree.XMLParser(). (#3545)
* 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.
2017-09-14 23:00:03 +03:00
Oren Milman 0b3a87ef54 bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (#3580) 2017-09-14 22:30:27 +03:00
Łukasz Langa f350a268a7 bpo-28556: typing.get_type_hints: better globalns for classes and modules (#3582)
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.
2017-09-14 14:33:00 -04:00
Eric Snow d393c1b227 bpo-28411: Isolate PyInterpreterState.modules (#3575)
A bunch of code currently uses PyInterpreterState.modules directly instead of PyImport_GetModuleDict(). This complicates efforts to make changes relative to sys.modules. This patch switches to using PyImport_GetModuleDict() uniformly. Also, a number of related uses of sys.modules are updated for uniformity for the same reason.

Note that this code was already reviewed and merged as part of #1638. I reverted that and am now splitting it up into more focused parts.
2017-09-14 12:18:12 -06:00
Victor Stinner 8dcf22f442 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
2017-09-14 08:43:22 -07:00
Victor Stinner 18e95b4176 bpo-31234: Join threads in tests (#3572)
Call thread.join() on threads to prevent the "dangling threads"
warning.
2017-09-14 08:43:04 -07:00
Łukasz Langa 1bbd482bcf bpo-31457: Allow for nested LoggerAdapter objects (#3551)
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.
2017-09-14 11:34:47 -04:00
Victor Stinner 5a61559fb0 _ssl_: Fix compiler warning (#3559)
Cast Py_buffer.len (Py_ssize_t, signed) to size_t (unsigned) to
prevent the following warning:

Modules/_ssl.c:3089:21: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
2017-09-14 10:10:30 +02:00
Eric Snow dae0276bb6 bpo-30860: Fix a refleak. (#3567)
Resolves bpo-31420.

(This was accidentally reverted when in #3565.)
2017-09-14 00:35:58 -07:00
Eric Snow 93c92f7d1d bpo-31404: Revert "remove modules from Py_InterpreterState (#1638)" (#3565)
PR #1638, for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506, a fix on top of #1638, is also getting reverted.
2017-09-13 23:46:04 -07:00
Serhiy Storchaka 13ad3b7a82 bpo-31462: Remove trailing whitespaces. (#3564) 2017-09-14 09:38:36 +03:00
sww 312ffead1e Improve code examples in hashlib cookie signing (GH-3562)
The `blake2b` function does not take the `data` keyword argument.
The hex digest returned by sign was a string, whereas compare_digest expects bytes-like objects.
Typo fix: compare_digesty -> compare_digest
2017-09-13 23:24:36 -07:00
Xiang Zhang c3e97d9d98 bpo-30246: fix several error messages which only mention bytes in struct (#1421) 2017-09-14 10:33:26 +08:00
Mariatta 1b8f612e18 bpo-31458: Update Misc/NEWS link in What's New page (GH-3555)
Update the link from Misc/NEWS to Misc/NEWS.d
2017-09-13 16:47:33 -07:00
Victor Stinner 096ae3373a bpo-31234: Try to fix lock_tests warning (#3557)
Try to fix the "Warning -- threading_cleanup() failed to cleanup 1
threads" warning in test.lock_tests: wait a little bit longer to give
time to the threads to complete.

Warning seen on test_thread and test_importlib.
2017-09-13 16:41:08 -07:00
Ivan Levkivskyi 65bc62052f bpo-28556: Minor updates to typing module (#3550)
* Copy changes to typing from upstream repo
* Add NEWS entry
2017-09-13 19:25:15 -04:00
Oren Milman f6e61df015 bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__ attribute. (#3539) 2017-09-14 01:30:05 +03:00
Victor Stinner ace1ecc00b bpo-31234: threading_cleanup() now warns immediately (#3138)
support.threading_cleanup() waits for 1 second before emitting a
warning if there are threads running in the background. With this
change, it now emits the warning immediately, to be able to catch
bugs more easily.
2017-09-13 13:42:00 -07:00
Joel Schaerer 88031a9ade Update subprocess.communicate() docstring.
Explicitly state that communicate() closes stdin after writing input to it.
2017-09-13 12:11:20 -07:00
Victor Stinner acb9fa79fa bpo-31234, socket.create_connection(): Fix ref cycle (#3546) 2017-09-13 10:10:10 -07:00
Victor Stinner b157ce1e58 bpo-31234: Fix dangling thread in test_ftplib (#3544)
Clear also self.server_thread attribute in TestTimeouts.tearDown().
2017-09-13 06:43:58 -07:00
Victor Stinner d165e14e29 bpo-31448, test_poplib: Fix ResourceWarning (#3542)
Call POP3.close(), don't close close directly the sock attribute.
2017-09-13 05:53:10 -07:00
Victor Stinner a7b3bc554c Travis CI: run coverage test using --fail-env-changed (#3541) 2017-09-13 05:17:27 -07:00
Victor Stinner d403a29c00 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.
2017-09-13 03:58:25 -07:00
Victor Stinner b8f4163da3 bpo-31233: socketserver.ThreadingMixIn.server_close() (#3523)
socketserver.ThreadingMixIn now keeps a list of non-daemonic threads
to wait until all these threads complete in server_close().

Reenable test_logging skipped tests.

Fix SocketHandlerTest.tearDown(): close the socket handler before
stopping the server, so the server can join threads.
2017-09-13 01:47:22 -07:00
Victor Stinner 97d7e65dfe bpo-30830: logging.config.listen() calls server_close() (#3524)
The ConfigSocketReceiver.serve_until_stopped() method from
logging.config.listen() now calls server_close() (of
socketserver.ThreadingTCPServer) rather than closing manually the
socket.

While this change has no effect yet, it will help to prevent dangling
threads once ThreadingTCPServer.server_close() will join spawned
threads (bpo-31233).
2017-09-13 01:44:08 -07:00
Louie Lu b8d1b9d7c6 Mention enum as an ex (#2982) 2017-09-12 21:44:14 -07:00
Mariatta ea0f7c26ce bpo-31394: Make tokenize.rst PEP 8-compliant (GH-3526)
The last commit contained lines longer than 80 characters.
2017-09-12 21:00:00 -07:00
Aivar Annamaa 5f8fbf917e bpo-31394: Clarify documentation about token type attribute (GH-3469)
Make it clear that Ellipsis tokens also have type attribute set to token.OP.
2017-09-12 20:24:03 -07:00
Victor Stinner 3bcf157c11 bpo-31249: Fix test_concurrent_futures dangling thread (#3521)
ProcessPoolShutdownTest.test_del_shutdown() now closes the call queue
and joins its thread, to prevent leaking a dangling thread.
2017-09-12 17:05:53 -07:00
Victor Stinner a15d155aad bpo-31234: Enhance test_thread.test_forkinthread() (#3516)
* 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.
2017-09-12 10:49:22 -07:00
Oren Milman d056818ed2 bpo-31428: Prevent raising a SystemError in case the memo arg of ElementTree.Element.__deepcopy__() isn't a dictionary. (#3512) 2017-09-12 17:39:15 +03:00
Terry Jan Reedy 98758bc67f bpo-31421: Document how IDLE runs tkinter programs. (#3513)
IDLE calls tcl/tk update in the background in order to make live
interaction and experimentatin with tkinter applications much easier.
2017-09-12 09:05:16 -04:00
Terry Jan Reedy adb4cd2a2a bpo-27099: Finish updating IDLE doc and help text. (#3510)
As needed for the conversion of extensions to features.
2017-09-12 07:45:15 -04:00
Eric Snow fc1bf872e9 bpo-30860: Move windows.h include out of internal/*.h. (#3458)
PR #3397 introduced a large number of warnings to the Windows build. This patch fixes them.
2017-09-11 18:30:43 -07:00
Eric Snow 8728018624 bpo-30860: Fix a refleak. (#3506)
* Drop warnoptions from PyInterpreterState.

* Drop xoptions from PyInterpreterState.

* Don't set warnoptions and _xoptions again.

* Decref after adding to sys.__dict__.

* Drop an unused macro.

* Check sys.xoptions *before* we delete it.
2017-09-11 17:59:22 -07:00
Eric Snow ba6d5d1def bpo-30860: Always provide serialno. (#3507)
This fixes bpo-31407.
2017-09-11 17:02:24 -07:00
Oren Milman 9d984fd2b0 bpo-31416: Fix assertion failures in case of a bad warnings.filters or warnings.defaultaction. (#3496)
Patch by Oren Milman.
2017-09-12 00:18:09 +03:00
Terry Jan Reedy 8239fd7046 bpo-30928: Update idlelib/NEWS.txt to 2017-09-11. (#3503) 2017-09-11 16:43:26 -04:00
Terry Jan Reedy 667522efa8 bpo-31414: IDLE -- fix tk entry box tests by deleting first. (#3501)
Adding to an int entry is not the same as deleting and inserting
because int('') will fail.
2017-09-11 16:02:33 -04:00
Victor Stinner 4866957e86 bpo-30860: Add Include/internal/ in "make tags" (#3498) 2017-09-11 09:34:36 -07:00