Victor Stinner [Thu, 15 Jun 2017 22:51:24 +0000 (00:51 +0200)]
Fix ref cycles in TestCase.assertRaises() (#193) (#2228)
bpo-23890: unittest.TestCase.assertRaises() now manually breaks a
reference cycle to not keep objects alive longer than expected.
(cherry picked from commit bbd3cf8f1ef1e91a8d6dac6411e18b4b9084abf5)
Victor Stinner [Thu, 15 Jun 2017 22:08:39 +0000 (00:08 +0200)]
bpo-30675: Fix multiprocessing code in regrtest (#2220)
* Rewrite code to pass slaveargs from the master process to worker
processes: reuse the same code of the Python master branch
* Move code to initialize tests in a new setup_tests() function,
similar change was done in the master branch
* In a worker process, call setup_tests() with the namespace built
from slaveargs to initialize correctly tests
Before this change, warm_caches() was not called in worker processes
because the setup was done before rebuilding the namespace from
slaveargs. As a consequence, the huntrleaks feature was unstable. For
example, test_zipfile reported randomly false positive on reference
leaks.
Serhiy Storchaka [Thu, 15 Jun 2017 14:16:55 +0000 (17:16 +0300)]
[3.5] bpo-29931 fix __lt__ check in ipaddress.ip_interface for both v4 and v6. (GH-879) (#2218)
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
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.
Nick Coghlan [Tue, 13 Jun 2017 10:32:24 +0000 (20:32 +1000)]
[3.5] bpo-29514: Check magic number for bugfix releases (#2158)
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.
Serhiy Storchaka [Mon, 12 Jun 2017 06:02:33 +0000 (09:02 +0300)]
[3.5] bpo-28994: Fixed errors handling in atexit._run_exitfuncs(). (GH-2034) (#2122)
The traceback no longer displayed for SystemExit raised in a callback registered by atexit.
(cherry picked from commit 3fd54d4a7e604067e2bc0f8cfd58bdbdc09fa7f4)
Mariatta [Sat, 10 Jun 2017 21:41:38 +0000 (14:41 -0700)]
bpo-28556: Updates to typing module (GH-2076) (GH-2088)
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 29fda8db16e0edab92841277fa223f844f5a92cc)
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 d52aa31378ae43e044a300edfe8285954c167216)
[3.5] bpo-30594: Fixed refcounting in newPySSLSocket (GH-1992) (#1993)
If pass a server_hostname= that fails IDNA decoding to SSLContext.wrap_socket or SSLContext.wrap_bio, then the SSLContext object had a spurious Py_DECREF called on it, eventually leading to segfaults.
(cherry picked from commit 65ece7ca2366308fa91a39a8dfa255e6bdce3cca)
Clarify that `two-pass` buffer can only be dumped once, and it prints out all text sent to it during all processing, even from Clinic blocks *after* the dumping point.
Mariatta [Mon, 5 Jun 2017 03:09:16 +0000 (20:09 -0700)]
bpo-30530: Update Descriptor How To Documentation (GH-1845) (GH-1954)
Update the code example in Functions and Methods section
Remove objtype argument in MethodType
(cherry picked from commit 1bced56567335745f91676192fc39c06aab30da9)
Brett Cannon [Sat, 3 Jun 2017 17:34:15 +0000 (10:34 -0700)]
[3.5] Turn on macOS builds for Travis (GH-1846) (GH-1930)
Initially the macOS builds are allowed to fail until such time that they can be determined to be stable and not add an unacceptable amount of time to the overall Travis-passing process.
(cherry picked from commit 21c2dd7cf8414c903f0e83cf1d6b7f02f645f422)
Mariatta [Thu, 1 Jun 2017 02:48:28 +0000 (19:48 -0700)]
bpo-22702: Clarify documentation of str.join & bytes.join (GH-156) (GH-1896)
The "iterable iterable" phrasing created confusion between the term
reference and the parameter name.
This simplifies the phrasing to just use the parameter name
without linking directly to the term definition.
(cherry picked from commit 08e2f355d04d3cbea5751ce1275306ee3f569b32)
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)