Commit Graph

9961 Commits

Author SHA1 Message Date
Miss Islington (bot) c923da188b [3.6] bpo-30058: Fixed buffer overflow in select.kqueue.control(). (GH-1095) (#3973)
(cherry picked from commit de07210077)
2017-10-12 23:20:44 +03:00
Berker Peksag 5f908005ce bpo-28647: Update -u documentation (GH-3954)
* stdout and stderr are always opened in text mode
* and they are line-buffered

Initial patch by Gareth Rees.
2017-10-11 17:09:57 +03:00
Miss Islington (bot) 764969a4b9 [3.6] bpo-28157: Improvements for the time module documentation (GH-928)
* Separated functions and constants descriptions in sections.
* Added a note about the limitations of timezone constants.
* Removed redundant lists from the module docstring.

(cherry picked from commit 703ff381ff)
2017-10-11 16:50:21 +03:00
Miss Islington (bot) a8ac71d15f [3.6] bpo-31728: Prevent crashes in _elementtree due to unsafe cleanup of Element.text and Element.tail (GH-3924) (#3945)
(cherry picked from commit 39ecb9c71b)
2017-10-11 00:51:28 +03:00
Miss Islington (bot) a65b2420f6 [3.6] bpo-31675: Fix memory leaks in Tkinter's methods splitlist() and split() (GH-3866) (#3874)
when pass a string larger than 2 GiB.

Decrease memory requirements for Tcl's bigmem tests.
(cherry picked from commit 27c623c845)
2017-10-03 23:50:46 +03:00
Serhiy Storchaka fcc832a4fa [3.6] bpo-31673: Fixed typo in the name of Tkinter's method adderrorinfo(). (GH-3864). (#3873)
(cherry picked from commit 929b40a601)
2017-10-03 22:39:37 +03:00
Victor Stinner 7d6ddb96b3 bpo-28129: fix ctypes crashes (#386) (#3799)
* init commit, with initial tests for from_param and fields __set__ and __get__, and some additions to from_buffer and from_buffer_copy

* added the rest of tests and patches. probably only a first draft.

* removed trailing spaces

* replace ctype with ctypes in error messages

* change back from ctypes instance to ctype instance

(cherry picked from commit 1bea762d9e)
2017-09-28 07:32:11 -07:00
Serhiy Storchaka befc956acf [3.6] bpo-31478: Fix an assertion failure in random.seed() in case a seed has a bad __abs__() method. (GH-3596) (#3794)
(cherry picked from commit d780b2d588)
2017-09-28 12:17:51 +03:00
Miss Islington (bot) 7c24e99c99 [3.6] bpo-31505: Fix an assertion failure in json, in case _json.make_encoder() received a bad encoder() argument. (GH-3643) (#3777)
(cherry picked from commit 2b382dd612)
2017-09-27 08:21:47 +03:00
Miss Islington (bot) bdb215b18a [3.6] bpo-31490: Fix an assertion failure in ctypes in case an _anonymous_ attr is defined only outside _fields_. (GH-3615) (#3774)
(cherry picked from commit 30b61b51e0)
2017-09-27 07:37:37 +03:00
Miss Islington (bot) a1c49f6f09 [3.6] bpo-31586: Use _count_element fast path for real dicts. (#3776)
(cherry picked from commit 31aca4bf79)
2017-09-26 20:45:57 -07:00
Miss Islington (bot) 69b2dc8637 [3.6] bpo-30347: Stop crashes when concurrently iterate over itertools.groupby() iterators. (GH-1557) (#3770)
(cherry picked from commit c740e4fe8a)
2017-09-26 22:20:22 +03:00
Miss Islington (bot) a6bddb8e43 [3.6] bpo-31311: Fix a SystemError and a crash in ctypes._CData.__setstate__(), in case of a bad __dict__. (GH-3254) (#3743)
(cherry picked from commit 57c2561c8c)
2017-09-25 11:49:08 +03:00
Miss Islington (bot) e2a30cd35b [3.6] bpo-27385: Clarify docstring for groupby() (GH-3738) (#3744)
(cherry picked from commit 49392c63a2)
2017-09-25 01:41:49 -07:00
Miss Islington (bot) 7e32cee1a6 [3.6] bpo-25359: Add missed "goto error" after setting an exception. (GH-3712) (#3714)
(cherry picked from commit d6238a76c6)
2017-09-24 03:29:17 +03:00
Miss Islington (bot) 88d0663005 [3.6] closes bpo-31532: Fix memory corruption due to allocator mix (GH-3679) (#3681)
Fix a memory corruption in getpath.c due to mixed memory allocators
between Py_GetPath() and Py_SetPath().

The fix use the Raw allocator to mimic the windows version.

This patch should be used from python3.6 to the current version

for more details, see the bug report and
  https://github.com/pyinstaller/pyinstaller/issues/2812
(cherry picked from commit 3d1e2ab584)
2017-09-20 23:47:12 -07:00
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) 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) 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) 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
Christian Heimes 472cc9f366 [3.6] _ssl_: Fix compiler warning (GH-3559) (#3569)
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].
(cherry picked from commit 5a61559fb0)
2017-09-14 11:15:07 +02:00
Xiang Zhang fa82dda101 [3.6] bpo-30246: fix several error messages which only mention bytes in struct (#3561) 2017-09-14 11:22:23 +08:00
Victor Stinner c0e77364ca [3.6] bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0 (#3518)
* bpo-30923: Disable warning that has been part of -Wextra since gcc-7.0. (#3142)

(cherry picked from commit d73a960c57)

* bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. (#3157)

(cherry picked from commit f432a3234f)

* bpo-31275: Small refactoring to silence a fall-through warning. (#3206)

(cherry picked from commit 138753c1b9)
2017-09-12 16:09:44 -07:00
Miss Islington (bot) f8909d0e4b [3.6] bpo-31406: Fix crash due to lack of type checking in subclassing. (GH-3477) (#3479)
(cherry picked from commit 3cedf46cdb)
2017-09-10 18:46:49 +02:00
Christian Heimes 16f16dbd0e [3.6] bpo-31400: Improve SSL error handling on Windows (GH-3463) (#3466)
* bpo-31392: Improve SSL error handling on Windows

* Remove unnecessary Windows mention in NEWS.
(cherry picked from commit e6eb48c10d)
2017-09-09 08:22:11 -07:00
Serhiy Storchaka ddb536ba7b [3.6] bpo-31393: Fix the use of PyUnicode_READY(). (GH-3451). (#3453)
(cherry picked from commit e3b2b4b8d9)
2017-09-08 10:43:54 +03: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 6c99b652f7 [3.6] bpo-28958: Improve SSLContext error reporting. (GH-3414) (#3432)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 17c9ac9)
2017-09-07 16:45:39 -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
Christian Heimes c3c3062169 [3.6] _pickle: Fix whichmodule() (GH-3358) (#3361)
_PyUnicode_FromId() can return NULL: replace Py_INCREF() with
Py_XINCREF().

Fix coverity report: CID 1417269.
(cherry picked from commit af46eb8)
2017-09-05 21:43:19 -07:00
Victor Stinner e5f2f80385 bpo-31170: Update libexpat from 2.2.3 to 2.2.4 (#3315) (#3350)
* bpo-31170: Update libexpat from 2.2.3 to 2.2.4

Fix copying of partial characters for UTF-8 input (libexpat bug 115):
https://github.com/libexpat/libexpat/issues/115

* Add NEWS entry.

(cherry picked from commit 759e30ec47)
2017-09-06 01:30:22 +02:00
Christian Heimes 63b3f2b19c [3.6] bpo-29334: Fix ssl.getpeercert for auto-handshake (GH-1769) (#1778)
Drop handshake_done and peer_cert members from PySSLSocket struct. The
peer certificate can be acquired from *SSL directly.
SSL_get_peer_certificate() does not trigger any network activity.
Instead of manually tracking the handshake state, simply use
SSL_is_init_finished().

In combination these changes fix auto-handshake for non-blocking
MemoryBIO connections.

Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 66dc33b682)
2017-09-05 13:43:05 -07:00
Christian Heimes f201e886fc [3.6] bpo-30502: Fix handling of long oids in ssl. (GH-2909) (#3321)
(cherry picked from commit e503ca5288)
2017-09-05 19:13:03 +02:00
Christian Heimes 2ddea0f098 [3.6] bpo-30102: Call OPENSSL_add_all_algorithms_noconf (GH-3112) (#3342)
The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on
OpenSSL < 1.1.0. The function detects CPU features and enables optimizations
on some CPU architectures such as POWER8. Patch is based on research from
Gustavo Serra Scalet.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit c941e62)
2017-09-05 17:12:03 +02:00
Christian Heimes 02854dab62 [3.6] bpo-31343: Include sys/sysmacros.h (GH-3318) (#3344)
Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray
plans to remove the functions from sys/types.h.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 75b9618)
2017-09-05 17:09:12 +02:00
Christian Heimes 7316c6d4a5 [3.6] bpo-30622: Change NPN detection: (GH-2079) (#3314)
* Change NPN detection:

Version breakdown, support disabled (pre-patch/post-patch):
- pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False
- 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will not be defined ->
False/False
- 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and
OPENSSL_NO_NEXTPROTONEG will be defined -> True/False

Version breakdown support enabled (pre-patch/post-patch):
- pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False
- 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will be defined and
OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True
- 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and
OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True

* Refine NPN guard:

- If NPN is disabled, but ALPN is available we need our callback
- Make clinic's ssl behave the same way

This created a working ssl module for me, with NPN disabled and ALPN
enabled for OpenSSL 1.1.0f.

Concerns to address:
The initial commit for NPN support into OpenSSL [1], had the
OPENSSL_NPN_* variables defined inside the OPENSSL_NO_NEXTPROTONEG
guard. The question is if that ever made it into a release.
This would need an ugly hack, something like:

	GH-if defined(OPENSSL_NO_NEXTPROTONEG) && \
		!defined(OPENSSL_NPN_NEGOTIATED)
	GH-	define OPENSSL_NPN_UNSUPPORTED 0
	GH-	define OPENSSL_NPN_NEGOTIATED 1
	GH-	define OPENSSL_NPN_NO_OVERLAP 2
	GH-endif

[1] https://github.com/openssl/openssl/commit/68b33cc5c7
(cherry picked from commit b2d096b)
2017-09-05 16:00:44 +02:00
Segev Finer 39fde5f93b [3.6] Add missing _sha3 module to Setup.dist (GH-2395) (#3280)
(cherry picked from commit 1c1f8f30c0)
2017-09-04 10:08:35 -07:00
INADA Naoki 2eea952b1b bpo-31095: fix potential crash during GC (GH-3195)
(cherry picked from commit a6296d34a4)
2017-09-04 12:31:09 +09:00
Gregory P. Smith 31b8efeaa8 [3.6] bpo-9146: Raise a ValueError if OpenSSL fails to init a hash func (#3274)
* [3.6] bpo-9146: Raise a ValueError if OpenSSL fails to init a hash func. (GH-1777)

This helps people in weird FIPS mode environments where common things
like MD5 are not available in the binary as a matter of policy.
(cherry picked from commit 07244a8301)

* Include a NEWS entry.
2017-09-03 14:35:19 -07: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
Christopher Wilcox 58521fdba1 bpo-30581: Windows: os.cpu_count() returns wrong number of processors (#2934) (#3267)
* Fixes #30581 by adding a path to use newer GetMaximumProcessorCount API on Windows calls to os.cpu_count()

* Add NEWS.d entry for bpo-30581, os.cpu_count on Windows.

* Tweak NEWS entry
2017-09-01 21:28:47 +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
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
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
Victor Stinner cb7fdf69ec bpo-28667: Fix a compile warning on FreeBSD when compare with FD_SETSIZE. (#501) (#3190)
FreeBSD is the only platforms with unsigned FD_SETSIZE.

(cherry picked from commit 783d0c1a1c)
2017-08-23 00:58:43 +02:00
Victor Stinner 83e37e16f3 bpo-30947: Update libexpat from 2.2.1 to 2.2.3 (#3106) (#3143)
* bpo-30947: Update libexpat from 2.2.1 to 2.2.3

* Add NEWS entry

* Add new loadlibrary.c

* expat_external.h: restore include "pyexpatns.h"

* PCbuild: add expat/loadlibrary.c

* Define XML_POOR_ENTROPY to compile expat

(cherry picked from commit 93d0cb58b4)
2017-08-19 01:06:27 +02:00
Victor Stinner ffbb6f7334 bpo-29619: Do not use HAVE_LARGEFILE_SUPPORT for type conversions (GH-1666) (#3102)
Use only the LongLong form for the conversions

(cherry picked from commit 50e86033de)
2017-08-17 14:33:06 +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