Commit Graph

99885 Commits

Author SHA1 Message Date
Antoine Pitrou bcaac8188b Revert "pytime: include winsock2, so we can have a complete timeval type (#3377)" (#3383)
This reverts commit 833860615b, as it broke Windows builds.
2017-09-06 13:31:09 +02:00
Ammar Askar 3fc499bca1 bpo-31178: Avoid concatenating bytes with str in subprocess error (#3066)
Avoid concatenating bytes with str in the typically rare subprocess error path (exec failed). Includes a mock based unittest to exercise the codepath.
2017-09-05 23:41:30 -07:00
Christian Heimes 6877111648 bpo-29781: Fix SSLObject.version before handshake (#3364)
SSLObject.version() now correctly returns None when handshake over BIO has
not been performed yet.

Signed-off-by: Christian Heimes <christian@python.org>
2017-09-05 21:55:40 -07:00
Christian Heimes 3463ee3972 Stop test_xmlrpc from writing to sys.stderr (#3359)
One test case of test_xmlrpc uses HTTPServer with a subclass of
BaseHTTPRequestHandler. The BaseRequestHandler class logs to
sys.stderr by default. Override log_message() to not clobber
test output.

Signed-off-by: Christian Heimes <christian@python.org>
2017-09-05 21:43:46 -07:00
Eric Snow 05351c1bd8 Revert "bpo-30860: Consolidate stateful runtime globals." (#3379)
Windows buildbots started failing due to include-related errors.
2017-09-05 21:43:08 -07:00
Benjamin Peterson 833860615b pytime: include winsock2, so we can have a complete timeval type (#3377) 2017-09-05 20:45:48 -07:00
Benjamin Peterson b0a9a5a6a4 correct initialization code (#3376)
Explicitly initialize struct members rather than relying on compiler extensions.
2017-09-05 20:19:12 -07:00
Eric Snow 76d5abc868 bpo-30860: Consolidate stateful runtime globals. (#2594)
* group the (stateful) runtime globals into various topical structs
* consolidate the topical structs under a single top-level _PyRuntimeState struct
* add a check-c-globals.py script that helps identify runtime globals

Other globals are excluded (see globals.txt and check-c-globals.py).
2017-09-05 18:26:16 -07:00
Victor Stinner 501b324d3a bpo-31355: Travis CI: remove the macOS job (#3367) 2017-09-06 02:57:14 +02:00
jimmylai 80bbe6a7b6 bpo-31350: Optimize get_event_loop and _get_running_loop (#3347)
* call remove_done_callback in finally section

* Optimize get_event_loop and _get_running_loop

* rename _loop_pid as loop_pid and add blurb news

* rename _loop_pid as loop_pid and add blurb news

* add back _RunningLoop

* Update 2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst

* Update 2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst
2017-09-05 20:36:59 -04:00
Christian Heimes 305e56c27a bpo-31320: No traceback to sys.stderr in test_ssl (#3360)
In case PROTOCOL_TLS_SERVER is used for both client context and server
context, the test thread dies with OSError. Catch OSError to avoid
traceback on sys.stderr

Signed-off-by: Christian Heimes <christian@python.org>
2017-09-05 16:37:09 -07:00
Benjamin Peterson 60dbed1850 link to legacy doc on the non-legacy website (#3362) 2017-09-05 16:24:39 -07:00
Jonathan Eunice faa57cbe70 bpo-30662: fixed OrderedDict.__init__ docstring re PEP 468 (#2179)
* fixed OrderedDict.__init__ docstring re PEP 468

* tightened comment and mirrored to C impl

* added space after period per marco-buttu

* preserved substituted for stable

* drop references to Python 3.6 and PEP 468
2017-09-05 16:23:49 -07:00
Victor Stinner af46eb8d5f _pickle: Fix whichmodule() (#3358)
_PyUnicode_FromId() can return NULL: replace Py_INCREF() with
Py_XINCREF().

Fix coverity report: CID 1417269.
2017-09-05 14:30:16 -07:00
Gregory P. Smith 564a2c68ad Link to blurb on PyPI in the NEWS.d READMEs. (#3323) 2017-09-05 10:38:05 -07:00
Raymond Hettinger 15ce0bee97 Conceptually, roots is a set. Also searching it as a set is a tiny bit faster (#3338) 2017-09-05 09:40:44 -07:00
Christian Heimes 75b961869a bpo-31343: Include sys/sysmacros.h (#3318)
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>
2017-09-05 15:53:09 +02:00
Christian Heimes c941e6238a bpo-30102: Call OPENSSL_add_all_algorithms_noconf (#3112)
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>
2017-09-05 15:47:11 +02:00
Ned Deily 52451fbaaf Prevent a few make suspicious warnings. (#3341) 2017-09-05 01:34:47 -07:00
Ned Deily fcd97d4438 Include additional changes to support blurbified NEWS (#3340) 2017-09-05 00:46:18 -07:00
Ned Deily e295b82609 Simplify NEWS entry to prevent suspicious warnings. (#3339) 2017-09-05 00:45:36 -07:00
Benjamin Peterson a3070d530c bpo-31347: _PyObject_FastCall_Prepend: do not call memcpy if args might not be null (#3329)
Passing NULL as the second argument to to memcpy is undefined behavior even if the size is 0.
2017-09-04 22:23:42 -07:00
Neil Schemenauer db564238db Revert "bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. (#1908)" (#3337)
This reverts commit e38d12ed34.
2017-09-04 22:13:17 -07:00
Neil Schemenauer e38d12ed34 bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. (#1908)
* Maintain a list of BufferedWriter objects.  Flush them on exit.

In Python 3, the buffer and the underlying file object are separate
and so the order in which objects are finalized matters.  This is
unlike Python 2 where the file and buffer were a single object and
finalization was done for both at the same time.  In Python 3, if
the file is finalized and closed before the buffer then the data in
the buffer is lost.

This change adds a doubly linked list of open file buffers.  An atexit
hook ensures they are flushed before proceeding with interpreter
shutdown.  This is addition does not remove the need to properly close
files as there are other reasons why buffered data could get lost during
finalization.

Initial patch by Armin Rigo.

* Use weakref.WeakSet instead of WeakKeyDictionary.

* Simplify buffered double-linked list types.

* In _flush_all_writers(), suppress errors from flush().

* Remove NEWS entry, use blurb.
2017-09-04 20:18:38 -07:00
Raymond Hettinger 64263dfd18 Fix terminology in comment and add more design rationale. (#3335)
* Fix terminology in comment and add more design rationale.

* Fix extra space
2017-09-04 18:54:16 -07:00
Raymond Hettinger 550370957c Add comment to explain the implications of not sorting keywords (#3331)
In Python 3.6, sorted() was removed from _make_key() for the lru_cache and instead rely on guaranteed keyword argument order preservation.  This makes keyword argument handling faster but it also causes multiple callers with a different keyword argument order to be cached as separate items.  Depending on your point of view, this is either a performance regression (increased number of cache misses) or a performance enhancement (faster computation of keys).
2017-09-04 17:47:53 -07:00
Victor Stinner 759e30ec47 bpo-31170: Update libexpat from 2.2.3 to 2.2.4 (#3315)
* 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.
2017-09-05 01:58:08 +02:00
Eric Snow 86b7afdfee bpo-28411: Remove "modules" field from Py_InterpreterState. (#1638)
sys.modules is the one true source.
2017-09-04 17:54:09 -06:00
Raymond Hettinger f5ea83f486 random_triangular: sqrt() is more accurate than **0.5 (#3317) 2017-09-04 16:51:06 -07:00
Christian Heimes 8adc73c2c1 Travis: use ccache (#3307) 2017-09-05 01:48:54 +02:00
Benjamin Peterson 069306312a remove IRIX support (closes bpo-31341) (#3310)
See PEP 11.
2017-09-04 16:36:05 -07:00
Raymond Hettinger e1b0287c04 Code clean-up. Remove unnecessary pre-increment before the loop starts. (#3312) 2017-09-04 16:07:06 -07:00
Zachary Ware af64aff9f7 Regen Moduls/clinic/_ssl.c.h (GH-3320)
Broken in GH-2079
2017-09-04 15:45:18 -07:00
Serhiy Storchaka e503ca5288 bpo-30502: Fix handling of long oids in ssl. (#2909) 2017-09-05 00:28:53 +02:00
Zachary Ware f801322e92 Cache externals, depending on changes to PCbuild (#3308) 2017-09-04 14:59:02 -07:00
Melvyn Sopacua b2d096bd2a bpo-30622: Change NPN detection: (#2079)
* 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:

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

[1] https://github.com/openssl/openssl/commit/68b33cc5c7
2017-09-04 23:35:15 +02:00
Barry Warsaw 973b901212 What's New for bpo-1198569 (#3303) 2017-09-04 17:29:27 -04:00
Steve Dower d5cd21d75a Fixes doc/make.bat to properly handle quoted paths. (#3302) 2017-09-04 14:26:27 -07:00
Benjamin Peterson 14ce158e3d remove configure.ac support for SGI_ABI (#3294) 2017-09-04 14:05:32 -07:00
Benjamin Peterson 5b79d60d2c remote note about IRIX in aifc (#3299)
This comment hasn't been true since Python 3.0.
2017-09-04 13:32:34 -07:00
Barry Warsaw ba4279683f bpo-1198569: Allow string.Template braced pattern to be different (#3288)
* bpo-1198569: Allow the braced pattern to be different

``string.Template`` subclasses can optionally define ``braceidpattern`` if
they want to specify different placeholder patterns inside and outside the
braces.  If None (the default) it falls back to ``idpattern``.
2017-09-04 16:32:10 -04:00
larryhastings f9f17346d7 Blurbify master branch. (#3298)
Blurbify master branch.
2017-09-04 13:30:19 -07:00
Christian Heimes 002d64039b bpo-25674: remove sha256.tbs-internet.com ssl test (#3297)
Signed-off-by: Christian Heimes <christian@python.org>
2017-09-04 22:26:01 +02:00
R. David Murray 0c7983e4ad Clarify nature of parse_args 'args' argument. (#3292)
Patch by Paul.j3.  Includes an unrelated but useful addition to the
optparse porting section.
2017-09-04 16:17:26 -04:00
Raymond Hettinger f58e6e2768 Add references to modules I am responsible for (#3291) 2017-09-04 12:31:15 -07:00
Barry Warsaw 1a589a604f Use a team to maintain the email related packages. (#3290) 2017-09-04 15:19:26 -04:00
Raymond Hettinger 1bfbe78b03 Improve clarity (and small speed-up) by using tuple unpacking (#3289) 2017-09-04 11:47:58 -07:00
Benjamin Peterson 5ce1063345 remove check for bug last seem in Solaris 9 (#3285) 2017-09-04 10:52:51 -07:00
Alex Gaynor 3239cf1ae9 Change code owners for hashlib and ssl to the crypto team (#3284)
* Change code owners for hashlib and ssl to the crypto team

* Include the core CSPRNG for the crypto-team
2017-09-04 13:40:45 -04:00
Zhiming Wang 06de1aeff9 bpo-31281: Fix pathlib.Path incompatibility in fileinput (gh-3208)
Fix fileinput with inplace=True to accept pathlib.Path objects.
2017-09-04 13:37:24 -04:00