Commit Graph

9974 Commits

Author SHA1 Message Date
Miss Islington (bot) f44a6299e2 Remove nested comments in blake2 (GH-4173) (#4214)
Replace occurence of nested comments in blake2 reference implementation
with preprocessor directive for disabling unused code.

`blake2s-load-xop.h` is conditionally pulled in only on chips with XOP
support, among others the AMD Bulldozer. The malformed comments in the
source file breaks the build of `hashlib`'s `_blake2` on GCC 6.3.0.

Official reference code on github uses `GH-if` so this change should be
uncontroversial.
(cherry picked from commit 388cd85e51)
2017-11-01 12:58:40 +00:00
Miss Islington (bot) ff6ae4de38 bpo-25720: Fix the method for checking pad state of curses WINDOW (GH-4164) (#4212)
Modify the code to use ncurses is_pad() instead of checking WINDOW
_flags field.  If your platform does not provide the is_pad(), the
existing way that checks the field will be enabled.

Note: This change does not drop support for platforms where do not
have both WINDOW _flags field and is_pad().
(cherry picked from commit 8bc7d63560)
2017-11-01 14:35:41 +02:00
Miss Islington (bot) 84e252b79e bpo-31893: Fix errors in b9052a0f91. (GH-4196) (#4201)
* Fix a compilation error on FreeBSD.
* Fix the data attribute size on Mac OS X.
(cherry picked from commit 2298fad5ff)
2017-10-31 20:16:07 +02:00
Miss Islington (bot) f9a639b97c bpo-31893: Fixed select.kqueue(). (GH-4166) (#4190)
* Fixed the layout of the kqueue_event structure on OpenBSD and NetBSD.
* Fixed the comparison of the kqueue_event objects.
(cherry picked from commit b9052a0f91)
2017-10-31 14:46:15 +02:00
Miss Islington (bot) 5db32085e7 bpo-31891: Fix building the curses module on NetBSD. (GH-4165) (#4189)
(cherry picked from commit baac01e629)
2017-10-31 14:33:09 +02:00
xdegaye 4b27d51222 [3.6] bpo-30697: Fix PyErr_NormalizeException() when no memory (GH-2327). (#4135)
(cherry picked from commit 56d1f5ca32)
2017-10-26 17:48:48 +02:00
Miss Islington (bot) 6e45d7b90a bpo-31752: Fix possible crash in timedelta constructor called with custom integers. (GH-3947) (#4086)
Bad remainder in divmod() in intermediate calculations caused an assertion failure.
(cherry picked from commit 4ffd4653a7)
2017-10-23 18:20:13 +03:00
Miss Islington (bot) aaf6a3dbbd [3.6] bpo-30695: Add set_nomemory(start, stop) to _testcapi (GH-2406) (#4083)
(cherry picked from commit 85f643023f)
2017-10-23 15:05:46 +02:00
Serhiy Storchaka 77af0a3bca [3.6] bpo-31572: Get rid of using _PyObject_HasAttrId() in pickle. (GH-3729). (#4081)
(cherry picked from commit 04e36af9b8)
2017-10-23 15:00:41 +03:00
Miss Islington (bot) 97abcabc19 [3.6] bpo-31334: Fix timeout in select.poll.poll() (GH-3277) (#4033)
Always pass -1, or INFTIM where defined, to the poll() system call when
a negative timeout is passed to the poll.poll([timeout]) method in the
select module. Various OSes throw an error with arbitrary negative
values.
(cherry picked from commit 6cfa927ceb)
2017-10-18 15:05:16 +03:00
Miss Islington (bot) be4e9cc769 [3.6] bpo-31806: Use _PyTime_ROUND_TIMEOUT for the timeout argument parsing in more functions (GH-4026) (#4032)
Fix timeout rounding in time.sleep(), threading.Lock.acquire() and
socket.socket.settimeout() to round correctly negative timeouts between -1.0 and
0.0. The functions now block waiting for events as expected. Previously, the
call was incorrectly non-blocking.
(cherry picked from commit 59af94fa61)
2017-10-18 12:09:57 +03:00
Pablo Galindo 95602b368b [3.6] bpo-31786: Make functions in the select module blocking when timeout is a small negative value. (GH-4003). (#4022)
(cherry picked from commit 2c15b29aea)
2017-10-18 11:12:47 +03:00
Miss Islington (bot) cfc604722f [3.6] completly -> completely (GH-3999) (closes bpo-31788) (#4008)
(cherry picked from commit 1295e11d39)
2017-10-15 12:48:50 -07:00
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