98865 Commits

Author SHA1 Message Date
Victor Stinner
231d1f3439 _PyEval_EvalCodeWithName(): remove redundant check
Replace the runtime check with an assertion (just in case).
2017-01-11 02:12:06 +01:00
Victor Stinner
b915bc354e Disable _PyStack_AsTuple() inlining
Issue #29234: Inlining _PyStack_AsTuple() into callers increases their stack
consumption, Disable inlining to optimize the stack consumption.

Add _Py_NO_INLINE: use __attribute__((noinline)) of GCC and Clang.

It reduces the stack consumption, bytes per call, before => after:

test_python_call: 1040 => 976 (-64 B)
test_python_getitem: 976 => 912 (-64 B)
test_python_iterator: 1120 => 1056 (-64 B)

=> total: 3136 => 2944 (- 192 B)
2017-01-11 01:07:03 +01:00
Victor Stinner
415c5107be Inline call_function()
Issue #29227: Inline call_function() into _PyEval_EvalFrameDefault() using
Py_LOCAL_INLINE to reduce the stack consumption.

It reduces the stack consumption, bytes per call, before => after:

test_python_call: 1152 => 1040 (-112 B)
test_python_getitem: 1008 => 976 (-32 B)
test_python_iterator: 1232 => 1120 (-112 B)

=> total: 3392 => 3136 (- 256 B)
2017-01-11 00:54:57 +01:00
Victor Stinner
434723f94c call_method() now uses _PyObject_FastCall()
Issue #29233: Replace the inefficient _PyObject_VaCallFunctionObjArgs() with
_PyObject_FastCall() in call_method() and call_maybe().

Only a few functions call call_method() and call it with a fixed number of
arguments. Avoid the complex and expensive _PyObject_VaCallFunctionObjArgs()
function, replace it with an array allocated on the stack with the exact number
of argumlents.

It reduces the stack consumption, bytes per call, before => after:

test_python_call: 1168 => 1152 (-16 B)
test_python_getitem: 1344 => 1008 (-336 B)
test_python_iterator: 1568 => 1232 (-336 B)

Remove the _PyObject_VaCallFunctionObjArgs() function which became useless.
Rename it to object_vacall() and make it private.
2017-01-11 00:07:40 +01:00
Xiang Zhang
dbdfecebd2 Issue #29217: Merge 3.6. 2017-01-10 11:30:44 +08:00
Xiang Zhang
2427d00298 Issue #29217: Merge 3.5. 2017-01-10 11:30:02 +08:00
Xiang Zhang
8a17995589 Issue #29217: Fix the wrong type description of UUID.variant. 2017-01-10 11:29:27 +08:00
Xiang Zhang
7a4da324dc Issue #29145: Merge 3.6. 2017-01-10 10:56:38 +08:00
Xiang Zhang
95403d74d7 Issue #29145: Merge 3.5. 2017-01-10 10:54:19 +08:00
Xiang Zhang
b0541f4cdf Issue #29145: Fix overflow checks in str.replace() and str.join().
Based on patch by Martin Panter.
2017-01-10 10:52:00 +08:00
Vinay Sajip
9ebb245db8 Closes #29177: Merged fix from 3.6. 2017-01-09 16:55:24 +00:00
Vinay Sajip
1e6499c19c Fixes #29177: Improved resilience of logging tests which use socket servers.
Thanks to Xavier de Gaye for the report and patch improvements.
2017-01-09 16:54:12 +00:00
Vinay Sajip
b5c557929e Closes #29133: merged update from 3.6.
Thanks to Evan_ for the report and Marco Buttu for the patch.
2017-01-09 16:48:23 +00:00
Vinay Sajip
aa655b3a8e Fixes #29133: clarified shlex documentation. 2017-01-09 16:46:04 +00:00
Raymond Hettinger
605a4476f8 Add test for ea064ff3c10f 2017-01-09 07:50:19 -08:00
Raymond Hettinger
68191f8a9c Backed out changeset ea064ff3c10f 2017-01-09 07:39:46 -08:00
Stefan Krah
3c29fd0074 While a speedup of 1% is measurable, contexts aren't created that often,
so let's defer this until 3.7, 3.8, ... all have this new function.
2017-01-09 13:53:32 +01:00
Stefan Krah
a40a3f35eb Merge 3.6. 2017-01-09 13:12:09 +01:00
Stefan Krah
e660335b7e Merge 3.5. 2017-01-09 13:11:51 +01:00
Stefan Krah
18e0a97a1a Issue #28701: Revert part of 5bdc8e1a50c8 for the following reasons:
- There was no real problem to begin with.

  - The hypothetical problem has been fixed by 5bdc8e1a50c8.
2017-01-09 13:11:27 +01:00
Victor Stinner
63ac30f5f1 Merge 3.6 2017-01-09 11:21:37 +01:00
Victor Stinner
a0be562daf Null merge 3.5
Python/random.c is more then in the 3.6 branch.
2017-01-09 11:21:26 +01:00
Victor Stinner
035ba5da3e Issue #29157: Prefer getrandom() over getentropy()
Copy and then adapt Python/random.c from default branch. Difference between 3.5
and default branches:

* Python 3.5 only uses getrandom() in non-blocking mode: flags=GRND_NONBLOCK
* If getrandom() fails with EAGAIN: py_getrandom() immediately fails and
  remembers that getrandom() doesn't work.
* Python 3.5 has no _PyOS_URandomNonblock() function: _PyOS_URandom()
  works in non-blocking mode on Python 3.5
2017-01-09 11:18:53 +01:00
Serhiy Storchaka
32999ab48a Issue #29190: Fixed possible errors in comparing strings in the pickle module. 2017-01-09 10:10:07 +02:00
Serhiy Storchaka
f0f35a6720 Issue #29190: Fixed possible errors in comparing strings in the pickle module. 2017-01-09 10:09:43 +02:00
Serhiy Storchaka
9937d90ee8 Issue #29190: Fixed possible errors in comparing strings in the pickle module. 2017-01-09 10:04:34 +02:00
Xiang Zhang
04c15d5bdc Issue #29142: Merge 3.6. 2017-01-09 11:52:10 +08:00
Xiang Zhang
c44d58a77a Issue #29142: Merge 3.5. 2017-01-09 11:50:02 +08:00
Xiang Zhang
959ff7f1c6 Issue #29142: Fix suffixes in no_proxy handling in urllib.
In urllib.request, suffixes in no_proxy environment variable with
leading dots could match related hostnames again (e.g. .b.c matches a.b.c).
Patch by Milan Oberkirch.
2017-01-09 11:47:55 +08:00
Raymond Hettinger
9d60b94427 Sync-up lru_cache() C code with space saving feature in the Python version. 2017-01-08 19:34:28 -08:00
Raymond Hettinger
44844ccc06 merge 2017-01-08 18:22:41 -08:00
Raymond Hettinger
19c7238560 Sync-up with 3.7 by backporting minor lru_cache code beautification 2017-01-08 18:22:24 -08:00
Raymond Hettinger
dda44682c6 Complete the merge for issue #29203 2017-01-08 18:04:30 -08:00
Raymond Hettinger
ac7c5acf9b merge 2017-01-08 17:29:21 -08:00
Raymond Hettinger
4ee39141e8 Issue #29203: functools.lru_cache() now respects PEP 468 2017-01-08 17:28:20 -08:00
Xiang Zhang
ce16c6827c Issue #29034: Merge 3.6. 2017-01-08 23:30:05 +08:00
Xiang Zhang
04316c4cc8 Issue #29034: Fix memory leak and use-after-free in path_converter. 2017-01-08 23:26:57 +08:00
Raymond Hettinger
bd41e0b3f1 merge 2017-01-08 00:37:32 -08:00
Raymond Hettinger
ec53b07ef1 Add OrderedDict test for PEP 468 (guaranteed ordered of kwargs) 2017-01-08 00:37:13 -08:00
Raymond Hettinger
1222e05a0d merge 2017-01-07 22:05:28 -08:00
Raymond Hettinger
d15bb26248 Update OrderedDict docs to reflect acceptance of PEP 468 2017-01-07 22:05:12 -08:00
Raymond Hettinger
5eed36fab4 Issue #29200: Fix test to use self.assertEqual instead of py.test style tests 2017-01-07 20:53:09 -08:00
Raymond Hettinger
d191ef25c1 Issue #29200: Add test for lru cache only calling __hash__ once 2017-01-07 20:44:48 -08:00
Martin Panter
4f5c6a27d8 Issue #28815: Merge test tweak from 3.6 2017-01-08 01:06:48 +00:00
Martin Panter
625fb648f7 Issue #28815: Merge test tweak from 3.5 2017-01-08 01:06:18 +00:00
Martin Panter
8cbd46f19f Issue #28815: Use new exception subclasses 2017-01-08 00:46:25 +00:00
Stefan Krah
aaa67862e8 Merge 3.6. 2017-01-08 01:36:46 +01:00
Stefan Krah
0b64a0fc64 Add comment why the change in d83884b3a427 wasn't necessary. 2017-01-08 01:36:00 +01:00
Stefan Krah
f4df2ee78c Merge 3.6. 2017-01-08 01:11:50 +01:00
Stefan Krah
dada5a8d75 Revert part of 3cb3e224b692 in code that I maintain. 2017-01-08 01:11:27 +01:00