csabella [Tue, 30 May 2017 20:47:47 +0000 (16:47 -0400)]
bpo-30354: Update data model documentation for super() (GH-1561) (GH-1869)
The data model section of the language reference was written well
before the zero-argument form of super() was added.
To avoid giving the impression that they're doing something
unusual, this updates the description of `__new__` and `__init__`
to use the zero-argument form.
Antoine Pitrou [Thu, 25 May 2017 15:19:10 +0000 (17:19 +0200)]
[3.5] bpo-30414: multiprocessing.Queue._feed do not break from main loop on exc (GH-1683) (#1816)
* bpo-30414: multiprocesing.Queue._feed do not break from main loop on exc
Queue background running thread was not handling exceptions correctly.
Any exception occurred inside thread (putting unpickable object) cause
feeder to finish running. After that every message put into queue is
silently ignored.
* bpo-30414: multiprocesing.Queue._feed do not break from main loop on exc
Queue background running thread was not handling exceptions correctly.
Any exception occurred inside thread (putting unpickable object) cause
feeder to finish running. After that every message put into queue is
silently ignored.
(cherry picked from commit bc50f03db4f58c869b78e98468e374d7e61f1227)
Zachary Ware [Wed, 24 May 2017 21:11:21 +0000 (16:11 -0500)]
[3.5] bpo-30160: Clarify intended usage of wfile (gh-1300) (GH-1792)
The library does not enforce compliance with the HTTP protocol,
so violations are not technically disallowed. Extend the stream's
description to avoid suggesting that intentional protocol violations are
not supported.
(cherry picked from commit a083c8e)
Victor Stinner [Wed, 17 May 2017 00:05:29 +0000 (17:05 -0700)]
bpo-30357: test_thread now uses threading_cleanup() (#1592) (#1623)
test_thread: setUp() now uses support.threading_setup() and
support.threading_cleanup() to wait until threads complete to avoid
random side effects on following tests.
Serhiy Storchaka [Tue, 16 May 2017 15:16:45 +0000 (18:16 +0300)]
[3.5] bpo-30375: Correct the stacklevel of regex compiling warnings. (GH-1595) (#1605)
Warnings emitted when compile a regular expression now always point
to the line in the user code. Previously they could point into inners
of the re module if emitted from inside of groups or conditionals..
(cherry picked from commit c7ac7280c321b3c1679fe5f657a6be0f86adf173)
Victor Stinner [Wed, 10 May 2017 12:13:37 +0000 (14:13 +0200)]
[3.5] bpo-30320, bpo-25277: backport test_eintr enhancements from master to 3.5 (#1532)
* bpo-30320: test_eintr now uses pthread_sigmask() (#1523)
Rewrite sigwaitinfo() and sigtimedwait() unit tests for EINTR using
pthread_sigmask() to fix a race condition between the child and the
parent process.
Remove the pipe which was used as a weak workaround against the race
condition.
sigtimedwait() is now tested with a child process sending a signal
instead of testing the timeout feature which is more unstable
(especially regarding to clock resolution depending on the platform).
(cherry picked from commit 211a392cc15f9a7b1b8ce65d8f6c9f8237d1b77f)
torsava [Tue, 9 May 2017 15:12:35 +0000 (17:12 +0200)]
[3.5] bpo-29243: Fix Makefile with respect to --enable-optimizations (GH-1478) (#1520)
* bpo-29243: Fix Makefile with respect to --enable-optimizations
When using the Profile Guided Optimization (./configure --enable-optimizations)
Python is built not only during `make` but rebuilt again during `make test`,
`make install` and others. This patch fixes the issue.
Note that this fix produces no change at all in the Makefile if configure is
run witout --enable-optimizations.
Victor Stinner [Fri, 5 May 2017 08:08:05 +0000 (10:08 +0200)]
bpo-30264: ExpatParser closes the source on error (#1451) (#1475)
ExpatParser.parse() of xml.sax.xmlreader now always closes the
source: close the file object or the urllib object if source is a
string (not an open file-like object). The change fixes a
ResourceWarning on parsing error.
[3.5] bpo-30243: Fixed the possibility of a crash in _json. (GH-1420) (#1470)
It was possible to get a core dump by using uninitialized
_json objects. Now __new__ methods create initialized objects.
__init__ methods are removed..
(cherry picked from commit 76a3e51a403bc84ed536921866c86dd7d07aaa7e)
Victor Stinner [Fri, 5 May 2017 00:19:59 +0000 (02:19 +0200)]
bpo-23404: make touch becomes make regen-all (#1405) (#1461) (#1465)
* bpo-23404: make touch becomes make regen-all (#1405)
Don't rebuild generated files based on file modification time
anymore, the action is now explicit. Replace "make touch"
with "make regen-all".
Changes:
* Remove "make touch", Tools/hg/hgtouch.py and .hgtouch
* Add a new "make regen-all" command to rebuild all generated files
* Add subcommands to only generate specific files:
- regen-ast: Include/Python-ast.h and Python/Python-ast.c
- regen-grammar: Include/graminit.h and Python/graminit.c
- regen-importlib: Python/importlib_external.h and Python/importlib.h
- regen-opcode: Include/opcode.h
- regen-opcode-targets: Python/opcode_targets.h
- regen-typeslots: Objects/typeslots.inc
* Rename PYTHON_FOR_GEN to PYTHON_FOR_REGEN
* pgen is now only built by by "make regen-grammar"
* Add $(srcdir)/ prefix to paths to source files to handle correctly
compilation outside the source directory
Note: $(PYTHON_FOR_REGEN) is no more used nor needed by "make"
default target building Python.
(cherry picked from commit a5c62a8e9f0de6c4133825a5710984a3cd5e102b)
Victor Stinner [Thu, 4 May 2017 11:21:16 +0000 (13:21 +0200)]
bpo-30225: Fix is_valid_fd() on macOS Tiger (#1443) (#1450)
is_valid_fd() now uses fstat() instead of dup() on macOS to return 0
on a pipe when the other side of the pipe is closed. fstat() fails
with EBADF in that case, whereas dup() succeed.
(cherry picked from commit 1c4670ea0cc3d208121af11b9b973e6bb268e570)
Mariatta [Wed, 3 May 2017 16:37:50 +0000 (09:37 -0700)]
[3.5] bpo-28556: Routine updates to typing (GH-1366) (#1417)
- Add NoReturn type
- Use WrapperDescriptorType (original PR by Jim Fasarakis-Hilliard)
- Minor bug-fixes
(cherry picked from commit f06e0218ef6007667f5d61184b85a81a0466d3ae)
Victor Stinner [Wed, 3 May 2017 00:12:34 +0000 (02:12 +0200)]
regrtest: always show before/after of modified env (#1407)
Buildbots don't run tests with -vv and so only log "xxx was modified
by test_xxx" which is not enough to debug such random issue. In many
cases, I'm unable to reproduce the warning and so unable to fix it.
Always logging the value before and value after should help to debug
such warning on buildbots.
(cherry picked from commit ec4b17239d899550be4ee6104b61751bb3c70382)
Victor Stinner [Tue, 2 May 2017 14:48:36 +0000 (16:48 +0200)]
bpo-30199: test_ssl closes all asyncore channels (#1381) (#1389)
AsyncoreEchoServer of test_ssl now calls
asyncore.close_all(ignore_all=True) to ensure that
asyncore.socket_map is cleared once the test completes, even if
ConnectionHandler was not correctly unregistered.
Fix the following warning:
Warning -- asyncore.socket_map was modified by test_ssl
Before: {}
After: {6: <test.test_ssl.AsyncoreEchoServer.EchoServer.ConnectionHandler>}
(cherry picked from commit 1dae7450c68bad498e57800387b24cb103c461fa)
Victor Stinner [Tue, 2 May 2017 14:26:04 +0000 (16:26 +0200)]
bpo-30132: distutils BuildExtTestCase use temp_cwd (#1387) (#1388)
BuildExtTestCase of test_distutils now uses support.temp_cwd() in
setUp() to remove files created in the current working in all
BuildExtTestCase unit tests, not only test_build_ext().
Victor Stinner [Tue, 2 May 2017 09:45:45 +0000 (11:45 +0200)]
bpo-30108: Restore sys.path in test_site (#1197) (#1379)
Add setUpModule() and tearDownModule() functions to test_site to
save/restore sys.path at the module level to prevent warning if the
user site directory is created, since site.addsitedir() modifies
sys.path.
(cherry picked from commit b85c136903c6d2368162f7c4a58f258c9c69ead0)
Victor Stinner [Tue, 2 May 2017 09:16:21 +0000 (11:16 +0200)]
bpo-30104: Use -fno-strict-aliasing on clang (#1376) (#1377)
Python/dtoa.c is not compiled correctly with clang 4.0 and
optimization level -O2 or higher, because of an aliasing issue on the
double/ULong[2] union. Only compile dtoa.c with -fno-strict-aliasing.
[3.5] bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (#1341) (#1346)
They now work when delete replaced attribute or item inside the with
statement. The old value of the attribute or item (or None if it doesn't
exist) now will be assigned to the target of the "as" clause, if there is
one.
* bpo-30107: Make SuppressCrashReport quiet on macOS (#1279) (#1335)
On macOS, SuppressCrashReport now redirects /usr/bin/defaults command
stderr into a pipe to not pollute stderr. It fixes a
test_io.test_daemon_threads_shutdown_stderr_deadlock() failure when
the CrashReporter domain doesn't exists. Message logged into stderr:
2017-04-24 16:57:21.432 defaults[41046:2462851]
The domain/default pair of (com.apple.CrashReporter, DialogType) does not exist
(cherry picked from commit d819ad9832292d854e9710493ecdf959b69802e3)
* bpo-30107: don't dump core on expected test_io crash (#1235)
test_io has two unit tests which trigger a deadlock:
These tests call Py_FatalError() if the expected bug is triggered
which calls abort(). Use test.support.SuppressCrashReport to prevent
the creation on a core dump, to fix the warning:
Warning -- files was modified by test_io
Before: []
After: ['python.core']
Victor Stinner [Fri, 28 Apr 2017 02:27:11 +0000 (04:27 +0200)]
bpo-30131: test_logging now joins queue threads (#1298) (#1318)
QueueListenerTest of test_logging now closes the multiprocessing
Queue and joins its thread to prevent leaking dangling threads to
following tests.
Add also @support.reap_threads to detect earlier if a test leaks
threads (and try to "cleanup" these threads).
(cherry picked from commit 8ca2f2faefa8dba323a2e4c4b86efb633d7a53cf)
bpo-29974: Improve typing.TYPE_CHECKING example (GH-982)
* Fix PEP 8 (SomeType instead of some_type)
* Add a function parameter annotation
* Explain, using wording from PEP 484 and PEP 526,
why one annotation is in quotes and another is not.
[3.5] bpo-29738: Fix memory leak in _get_crl_dp (GH-526) (GH-1143)
* Remove conditional on free of `dps`, since `dps` is now allocated for
all versions of OpenSSL
* Remove call to `x509_check_ca` since it was only used to cache
the `crldp` field of the certificate
CRL_DIST_POINTS_free is available in all supported versions of OpenSSL
(recent 0.9.8+) and LibreSSL.
(cherry picked from commit 2849cc34a8db93d448a62d69c462402347b50dcb)
[3.5] bpo-29692: contextlib.contextmanager may incorrectly unchain RuntimeError (GH-949) (#1107)
contextlib._GeneratorContextManager.__exit__ includes a special case to deal with
PEP 479 RuntimeErrors created when `StopIteration` is thrown into the context
manager body.
Previously this check was too permissive, and undid one level of chaining on *all*
RuntimeError instances, not just those that wrapped a StopIteration instance.
(cherry picked from commit 00c75e9a45ff0366c185e9e8a2e23af5a35481b0)