bpo-34879: Fix a possible null pointer dereference in bytesobject.c (GH-9683)
formatfloat() was not checking if PyBytes_FromStringAndSize()
failed, which could lead to a null pointer dereference in
_PyBytes_FormatEx().
(cherry picked from commit 96c593279400693226d5a560c420ae0fcf1731b9)
bpo-34172: multiprocessing.Pool leaks resources after being deleted (GH-8450) (GH-9677)
Fix a reference issue inside multiprocessing.Pool that caused the pool to remain alive if it was deleted without being closed or terminated explicitly.
(cherry picked from commit 97bfe8d3ebb0a54c8798f57555cb4152f9b2e1d0)
bpo-34521: Fix tests in test_multiprocessing_spawn to use correctly CMSG_SPACE (GH-9613)
After some failures in AMD64 FreeBSD CURRENT Debug 3.x buildbots
regarding tests in test_multiprocessing_spawn and after examining
similar failures in test_socket, some errors in the calculation of
ancillary data buffers were found in multiprocessing.reduction.
CMSG_LEN() can often be used as the buffer size for recvmsg() to
receive a single item of ancillary data, but RFC 3542 requires portable
applications to use CMSG_SPACE() and thus include space for padding,
even when the item will be the last in the buffer.
Fix tests in test_socket to use correctly CMSG_LEN (GH-9594)
After some failures in AMD64 FreeBSD CURRENT Debug 3.x buildbots
regarding tests in test_socket that are using
testFDPassSeparateMinSpace(), FreeBDS revision 337423 was pointed
out to be the reason the test started to fail.
A close examination of the manpage for cmsg_space(3) reveals that
the number of file descriptors needs to be taken into account when
using CMSG_LEN().
This commit fixes tests in test_socket to use correctly CMSG_LEN, taking
into account the number of FDs.
(cherry picked from commit 7291108d88ea31d205da4db19d202d6cbffc6d93)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
bpo-34819: Use a monotonic clock to compute timeouts in concurrent.futures (GH-9599)
Use a monotonic clock to compute timeouts in :meth:`Executor.map` and :func:`as_completed`, in order to prevent timeouts from deviating when the system clock is adjusted.
This may not be sufficient on all systems. On POSIX for example, the actual waiting (e.g. in ``sem_timedwait``) is specified to rely on the CLOCK_REALTIME clock.
(cherry picked from commit a94ee12c26aa8dd7dce01373779df8055aff765b)
Currently, the docs state that when doing `Type[X]`, X is only allowed to
be a class, a union of classes, and Any. This pull request amends
that sentence to clarify X may also be a typevar (or a union involving
classes, Any, and TypeVars).
(cherry picked from commit 130717fe58abb2ab9e7938207df0c130a2562747)
Co-authored-by: Michael Lee <michael.lee.0x2a@gmail.com>
Victor Stinner [Wed, 26 Sep 2018 14:44:45 +0000 (07:44 -0700)]
Drop confusing commented out code in pystrtod.c (GH-6072) (GH-9587)
Fix the following warning:
Python/pystrtod.c: In function 'format_float_short':
Python/pystrtod.c:1007:13: warning: 'strncpy' output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation]
strncpy(p, "ERR", 3);
Ned Deily [Wed, 26 Sep 2018 03:38:11 +0000 (23:38 -0400)]
bpo-34370: Update Tk 8.6 used with macOS installers
Have macOS 10.9+ installer builds for 3.7.1rc and 3.6.7rc use a development
snapshot of Tk 8.6 (post-8.6.8) to mitigate certain scroller issues seen
with IDLE and tkinter apps.
Christian Heimes [Mon, 24 Sep 2018 12:38:31 +0000 (14:38 +0200)]
[3.6] bpo-17239: Disable external entities in SAX parser (GH-9217) (GH-9512)
The SAX parser no longer processes general external entities by default
to increase security. Before, the parser created network connections
to fetch remote files or loaded local files from the file system for DTD
and entities.
Christian Heimes [Sun, 23 Sep 2018 07:23:01 +0000 (09:23 +0200)]
[3.6] bpo-34670: Add TLS 1.3 post handshake auth (GH-9460) (GH-9507)
Add SSLContext.post_handshake_auth and
SSLSocket.verify_client_post_handshake for TLS 1.3 post-handshake
authentication.
Signed-off-by: Christian Heimes <christian@python.org>q
https://bugs.python.org/issue34670.
(cherry picked from commit 9fb051f032c36b9f6086b79086b4d6b7755a3d70)
Co-authored-by: Christian Heimes <christian@python.org>
https://bugs.python.org/issue34670
Christian Heimes [Sat, 22 Sep 2018 05:10:06 +0000 (07:10 +0200)]
[3.6] bpo-34759: Fix error handling in ssl 'unwrap()' (GH-9468) (GH-9492)
OpenSSL follows the convention that whenever you call a function, it
returns an error indicator value; and if this value is negative, then
you need to go look at the actual error code to see what happened.
Commit c6fd1c1c3a introduced a small mistake in
_ssl__SSLSocket_shutdown_impl: instead of checking whether the error
indicator was negative, it started checking whether the actual error
code was negative, and it turns out that the error codes are never
negative. So the effect was that 'unwrap()' lost the ability to raise
SSL errors.
The test tries to fill the receiver's socket buffer and expects an
error. But the RDS protocol doesn't require that. Moreover, the Linux
implementation of RDS expects that the producer of the messages
reduces its rate, it's not the role of the receiver to trigger an
error.
bpo-34200: Fix non-determinism of test_pkg (GH-9248)
This causes the tearDown code to only unimport the test modules specifically created as part of each test via the self.mkhier method rather than abusing test.support.modules_setup() and the scary test.support.modules_cleanup() code.
closes bpo-34004: Skip lock interruption tests on musl. (GH-9224)
Returning EINTR from pthread semaphore or lock acquisition is an optional POSIX
feature. musl does not provide this feature, so some threadsignal tests fail
when Python is built against it.
There's no good way to test for musl, so we skip if we're on Linux and not using
glibc pthreads.
Also, hedge in the threading documentation about when we can provide interrupts
from lock acquisition.
(cherry picked from commit 5b10d5111d7a855297654af9045f8907b7d3dd08)
Co-authored-by: Benjamin Peterson <benjamin@python.org>
This also removes the old manual p2cread, c2pwrite, and errwrite closing logic
as inheritable flags and _close_open_fds takes care of that properly today without special treatment.
This code is within child_exec() where it is the only thread so there is no
race condition between the dup and _Py_set_inheritable_async_safe call.
(cherry picked from commit ce34410b8b67f49d8275c05d51b3ead50cf97f48)
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
[3.6] Fix misleading mentions of tp_size in comments (GH-9137)
Many type object initializations labeled a field "tp_size" in the
comment, but the name of that field is tp_basicsize..
(cherry picked from commit 0e0bc4e221f592f305d335faf5f8046484eb9238)
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>
bpo-34588: Fix an off-by-one error in traceback formatting. (GH-9077)
The recursive frame pruning code always undercounted the number of elided frames
by one. That is, in the "[Previous line repeated N more times]" message, N would
always be one too few. Near the recursive pruning cutoff, one frame could be
silently dropped. That situation is demonstrated in the OP of the bug report.
[3.6] bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098) (GH-9105)
Pass the user/group name as Unicode to the formatting function,
instead of always decoding a bytes string from UTF-8..
(cherry picked from commit 28658485a54ad5f9df52ecc12d9046269f1654ec)
Co-authored-by: William Grzybowski <wg@FreeBSD.org>
Pablo Galindo [Sat, 8 Sep 2018 01:20:27 +0000 (02:20 +0100)]
[3.6] bpo-34246: Use no mutable default args in smtplib (GH-8554) (#9112)
Some methods of the SMTP class use mutable default arguments. Specially
`send_message` is affected as it mutates one of the args by appending items
to it, which has side effects on further calls..
(cherry picked from commit d5fbe9b1a3d65ceeb9159c5ba999ee966a945f76)
Pablo Galindo [Fri, 7 Sep 2018 22:10:28 +0000 (23:10 +0100)]
[3.6] bpo-34007: Skip traceback tests if the Program Counter is not available. (GH-9022)
Sometimes some versions of the shared libraries that are part of the
traceback are compiled in optimised mode and the Program Counter (PC)
is not present, not allowing gdb to walk the frames back. When this
happens, the Python bindings of gdb raise an exception, making the
test impossible to succeed.
(cherry picked from commit f2ef51f8bec525b21e52988880c8a029642795ed)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
bpo-25750: fix refcounts in type_getattro() (GH-6118) (GH-9088)
When calling tp_descr_get(self, obj, type), make sure that
we own a strong reference to "self".
(cherry picked from commit 8f735485acf2e35a75d2fa019feb8f905598c4e5)
distutils.spawn.find_executable() now falls back on os.defpath if the
PATH environment variable is not set.
(cherry picked from commit 39487196c87e28128ea907a0d9b8a88ba53f68d5)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Zachary Ware [Wed, 5 Sep 2018 14:42:53 +0000 (09:42 -0500)]
[3.6] bpo-34575: Build with only VS2015 on AppVeyor (GH-9066)
Remove VS2017 image from AppVeyor config.
We're currently having caching issues between the two images, and VS2017 builds are tested by VSTS. Removing that one here will significantly decrease the time that AppVeyor builds take on this branch.