Victor Stinner
561ca80cff
Document why functools.partial() must copy kwargs ( #253 )
...
Add a comment to prevent further attempts to avoid a copy for
optimization.
2017-02-23 18:26:43 +01:00
Xiang Zhang
4cee049f5b
bpo-27660: remove unnecessary overflow checks in list_resize (GH-189)
2017-02-22 12:32:30 +08:00
INADA Naoki
3e8d6cb189
bpo-29509: skip redundant intern (GH-197)
...
PyObject_GetAttrString intern temporary key string.
It's completely redudant.
2017-02-21 23:57:25 +09:00
Mark Dickinson
112ec38c15
bpo-29602: fix signed zero handling in complex constructor. ( #203 )
...
* Fix incorrect handling of signed zeros for complex-related classes.
* Add Misc/NEWS entry.
2017-02-20 20:28:15 +00:00
INADA Naoki
1b8df107f8
bpo-24274: fix erroneous comment in dictobject.c (GH-196)
...
lookdict_unicode() and lookdict_unicode_nodummy() may raise exception
when key is not unicode.
2017-02-20 22:48:10 +09:00
Xiang Zhang
d0e8212ed7
bpo-29347: Fix possibly dereferencing undefined pointers when creating weakref objects ( #128 )
2017-02-20 12:25:16 +08:00
INADA Naoki
72dccde884
bpo-29548: Fix some inefficient call API usage (GH-97)
2017-02-16 09:26:01 +09:00
Victor Stinner
c22bfaae83
bpo-29524: Add Objects/call.c file ( #12 )
...
* Move all functions to call objects in a new Objects/call.c file.
* Rename fast_function() to _PyFunction_FastCallKeywords().
* Copy null_error() from Objects/abstract.c
* Inline type_error() in call.c to not have to copy it, it was only
called once.
* Export _PyEval_EvalCodeWithName() since it is now called
from call.c.
2017-02-12 19:27:05 +01:00
INADA Naoki
2294f3aee1
bpo-29438: fixed use-after-free in key sharing dict ( #17 )
2017-02-12 13:51:30 +09:00
Victor Stinner
d2306cec4d
Backed out changeset f23fa1f7b68f
...
Sorry, I didn't want to push this change before the review :-( I was pushing a
change into the 2.7 branch.
2017-02-10 14:19:36 +01:00
Victor Stinner
766af559ad
Issue #29465 : Add Objects/call.c file
...
* Move all functions to call objects in a new Objects/call.c file.
* Rename fast_function() to _PyFunction_FastCallKeywords().
* Copy null_error() from Objects/abstract.c
* Inline type_error() in call.c to not have to copy it, it was only
called once.
* Export _PyEval_EvalCodeWithName() since it is now called
from call.c.
2017-02-10 13:32:29 +01:00
Victor Stinner
fe4ff83049
Issue #29507 : Fix _PyObject_CallFunctionVa()
...
is_size_t test was reversed. Bug spotted by INADA Naoki.
2017-02-10 00:41:06 +01:00
Victor Stinner
516b98161a
Optimize slots: avoid temporary PyMethodObject
...
Issue #29507 : Optimize slots calling Python methods. For Python methods, get
the unbound Python function and prepend arguments with self, rather than
calling the descriptor which creates a temporary PyMethodObject.
Add a new _PyObject_FastCall_Prepend() function used to call the unbound Python
method with self. It avoids the creation of a temporary tuple to pass
positional arguments.
Avoiding temporary PyMethodObject and avoiding temporary tuple makes Python
slots up to 1.46x faster. Microbenchmark on a __getitem__() method implemented
in Python:
Median +- std dev: 121 ns +- 5 ns -> 82.8 ns +- 1.0 ns: 1.46x faster (-31%)
Co-Authored-by: INADA Naoki <songofacandy@gmail.com>
2017-02-09 22:53:47 +01:00
Victor Stinner
12c5838dae
Fix PyCFunction_Call() performance issue
...
Issue #29259 , #29465 : PyCFunction_Call() doesn't create anymore a redundant
tuple to pass positional arguments for METH_VARARGS.
Add a new cfunction_call() subfunction.
2017-02-09 02:01:37 +01:00
Victor Stinner
620580f280
Fix refleaks if Py_EnterRecursiveCall() fails
...
Issue #29306 : Destroy argstuple and kwdict if Py_EnterRecursiveCall() fails.
2017-02-08 12:57:09 +01:00
Victor Stinner
7399a05965
Issue #29306 : Fix usage of Py_EnterRecursiveCall()
...
* *PyCFunction_*Call*() functions now call Py_EnterRecursiveCall().
* PyObject_Call() now calls directly _PyFunction_FastCallDict() and
PyCFunction_Call() to avoid calling Py_EnterRecursiveCall() twice per
function call
2017-02-08 12:06:00 +01:00
Serhiy Storchaka
68a001dd59
Issue #29460 : _PyArg_NoKeywords(), _PyArg_NoStackKeywords() and
...
_PyArg_NoPositional() now are macros.
2017-02-06 10:41:46 +02:00
Raymond Hettinger
5cd87a8d61
Reduce load factor (from 66% to 60%) to improve effectiveness of linear probing.
...
Decreased density gives better collision statistics (average of 2.5 probes in a
full table versus 3.0 previously) and fewer occurences of starting a second
possibly overlapping sequence of 10 linear probes. Makes resizes a little more
frequent but each with less work (fewer insertions and fewer collisions).
2017-02-04 02:43:42 -08:00
Serhiy Storchaka
19d2597ed5
Issue #29311 : Regenerate Argument Clinic.
2017-02-04 08:05:07 +02:00
INADA Naoki
5566bbb8d5
Issue #29263 : LOAD_METHOD support for C methods
...
Calling builtin method is at most 10% faster.
2017-02-03 07:43:03 +09:00
Raymond Hettinger
e1af6964b4
Remove unnecessary variables.
...
* so->used never gets changed during a resize
* so->filled only changes when dummies are present and being eliminated
2017-02-02 08:24:48 -08:00
Serhiy Storchaka
196a7bc1ea
Issue #29421 : Make int.to_bytes() and int.from_bytes() slightly faster
...
(10-20% for small integers).
2017-02-02 16:54:45 +02:00
Serhiy Storchaka
495e8808d7
Issue #20185 : Converted the int class to Argument Clinic.
...
Based on patch by Vajrasky Kok.
2017-02-01 23:12:20 +02:00
INADA Naoki
35a96a25ee
Issue #29383 : reduce temporary interned unicode
...
add_methods(), add_members(), and add_getset() used PyDict_SetItemString()
to register descriptor to the type's dict.
So descr_new() and PyDict_SetItemString() creates interned unicode from same
C string.
This patch takes interned unicode from descriptor, and use PyDict_SetItem()
instead of PyDict_SetItemString().
python_startup_no_site:
default: Median +- std dev: 12.7 ms +- 0.1 ms
patched: Median +- std dev: 12.5 ms +- 0.1 ms
2017-01-28 16:35:44 +09:00
Victor Stinner
bda5a2be37
Issue #29358 : Add postcondition checks on types
2017-01-25 23:33:27 +01:00
Serhiy Storchaka
6e08baf12d
Issue #27867 : Function PySlice_GetIndicesEx() is deprecated and replaced with
...
a macro if Py_LIMITED_API is not set or set to the value between 0x03050400
and 0x03060000 (not including) or 0x03060100 or higher. Added functions
PySlice_Unpack() and PySlice_AdjustIndices().
2017-01-25 13:27:44 +02:00
Serhiy Storchaka
512c57cb72
Issue #27867 : Function PySlice_GetIndicesEx() is replaced with a macro if
...
Py_LIMITED_API is not set or set to the value between 0x03050400
and 0x03060000 (not including) or 0x03060100 or higher.
2017-01-25 13:25:52 +02:00
Serhiy Storchaka
b2a5be0763
Issue #27867 : Function PySlice_GetIndicesEx() is replaced with a macro if
...
Py_LIMITED_API is not set or set to the value between 0x03050400
and 0x03060000 (not including) or 0x03060100 or higher.
2017-01-25 13:23:05 +02:00
Serhiy Storchaka
78d9e58f20
Issues #29311 , #29289 : Fixed and improved docstrings for dict and OrderedDict
...
methods.
2017-01-25 00:30:04 +02:00
Serhiy Storchaka
067cbd02bf
Issue #29337 : Fixed possible BytesWarning when compare the code objects.
...
Warnings could be emitted at compile time.
2017-01-24 20:54:07 +02:00
Serhiy Storchaka
4102d25b7e
Issue #29337 : Fixed possible BytesWarning when compare the code objects.
...
Warnings could be emitted at compile time.
2017-01-24 20:52:43 +02:00
Serhiy Storchaka
713640c4c9
Issue #29337 : Fixed possible BytesWarning when compare the code objects.
...
Warnings could be emitted at compile time.
2017-01-24 20:49:26 +02:00
Victor Stinner
c3858bd7c6
Issue #29360 : _PyStack_AsDict() doesn't check kwnames
...
Remove two assertions which can fail on legit code. Keyword arguments are
checked later with better tests and raise a regular (TypeError) exception.
2017-01-24 15:05:30 +01:00
Martin Panter
91a8866dc1
Fix grammar in doc string, RST markup
2017-01-24 00:30:06 +00:00
Serhiy Storchaka
d1302c0154
Issue #28999 : Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
...
possible but Coccinelle couldn't find opportunity.
2017-01-23 10:23:58 +02:00
Serhiy Storchaka
228b12edcc
Issue #28999 : Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
...
possible. Patch is writen with Coccinelle.
2017-01-23 09:47:21 +02:00
Serhiy Storchaka
2a404b63d4
Issue #28769 : The result of PyUnicode_AsUTF8AndSize() and PyUnicode_AsUTF8()
...
is now of type "const char *" rather of "char *".
2017-01-22 23:07:07 +02:00
Serhiy Storchaka
7cf8bebb07
Issue #29331 : Simplified argument parsing in sorted() and list.sort().
2017-01-21 23:05:00 +02:00
Serhiy Storchaka
a70eaf21e3
Issue #29289 : Argument Clinic generates reasonable name for the parameter "default".
2017-01-19 19:38:13 +02:00
Serhiy Storchaka
48088ee9ba
Issue #29311 : Argument Clinic generates reasonable name for the parameter "default".
2017-01-19 19:00:30 +02:00
Serhiy Storchaka
41baebd8b9
Issue #20186 : Converted builtins enumerate() and reversed() to Argument Clinic.
...
Patch by Tal Einat.
2017-01-19 18:48:17 +02:00
Victor Stinner
91f0d4aa2f
Add a note explaining why dict_update() doesn't use METH_FASTCALL
...
Issue #29312 .
2017-01-19 12:45:06 +01:00
Victor Stinner
7dc6a5f50a
dict.get() and dict.setdefault() now use AC
...
Issue #29311 : dict.get() and dict.setdefault() methods now use Argument Clinic
to parse arguments. Their calling convention changes from METH_VARARGS to
METH_FASTCALL which avoids the creation of a temporary tuple.
The signature of docstrings is also enhanced. For example,
get(...)
becomes:
get(self, key, default=None, /)
2017-01-19 12:37:13 +01:00
Victor Stinner
06d34393c2
_PyStack_AsDict() now checks kwnames != NULL
...
Issue #29259 .
2017-01-18 18:06:32 +01:00
Victor Stinner
0a2e46835d
Cleanup _PyMethodDef_RawFastCallDict()
...
Issue #29259 : use a different case for METH_VARARGS and
METH_VARARGS|METH_KEYWORDS to avoid testing again flags to decide if keywords
should be checked or not.
2017-01-18 14:16:57 +01:00
Victor Stinner
a8cb515a29
Rephrase !PyErr_Occurred() comment: may=>can
...
Issue #29259 .
2017-01-18 14:12:51 +01:00
Victor Stinner
98ccba8344
_PyObject_FastCallKeywords() now checks !PyErr_Occurred()
...
Issue #29259 . All other functions calling functions start with the similar
assertion.
2017-01-18 14:06:38 +01:00
Victor Stinner
c89ef828cf
PyCFunction_Call() now calls _PyCFunction_FastCallDict()
...
Issue #29259 . We had 3 versions of similar code:
* PyCFunction_Call()
* _PyCFunction_FastCallDict()
* _PyCFunction_FastCallKeywords()
PyCFunction_Call() now calls _PyCFunction_FastCallDict() to factorize the code.
2017-01-18 14:04:37 +01:00
Victor Stinner
250e4b0063
Fix _PyMethodDef_RawFastCallDict() argument parsing
...
Issue #29259 :
* Move also the !PyErr_Occurred() assertion to the top, similar to
other functions.
* Fix also comment/error messages: the function was renamed to
_PyMethodDef_RawFastCallDict()
2017-01-18 14:01:12 +01:00
Victor Stinner
2a1b676d1f
_PyObject_FastCallKeywords() now checks the result
...
Issue ##27830, Issue #29259 .
2017-01-18 11:27:22 +01:00
Victor Stinner
c52572319c
Optimize methoddescr_call(): avoid temporary PyCFunction
...
Issue #29259 , #29263 . methoddescr_call() creates a PyCFunction object, call it
and the destroy it. Add a new _PyMethodDef_RawFastCallDict() method to avoid
the temporary PyCFunction object.
2017-01-18 10:38:09 +01:00
Victor Stinner
35ecebe165
Remove unused func parameter of _PyStack_UnpackDict()
...
Issue #29259 .
2017-01-18 10:31:46 +01:00
Victor Stinner
b05cbac052
Convert some OrderedDict methods to Argument Clinic
...
Issue #29289 . Convert methods:
* fromkeys() class method
* setdefault()
* popitem()
* move_to_end()
2017-01-17 03:46:13 +01:00
Victor Stinner
0c4a828cad
Run Argument Clinic: METH_VARARGS=>METH_FASTCALL
...
Issue #29286 . Run Argument Clinic to get the new faster METH_FASTCALL calling
convention for functions using "boring" positional arguments.
Manually fix _elementtree: _elementtree_XMLParser_doctype() must remain
consistent with the clinic code.
2017-01-17 02:21:47 +01:00
Victor Stinner
259f0e4437
Run Argument Clinic: METH_VARARGS=>METH_FASTCALL
...
Issue #29286 . Run Argument Clinic to get the new faster METH_FASTCALL calling
convention for functions using only positional arguments.
2017-01-17 01:35:17 +01:00
Victor Stinner
998c20962c
_PyStack_UnpackDict() now returns -1 on error
...
Issue #29286 . Change _PyStack_UnpackDict() prototype to be able to notify of
failure when args is NULL.
2017-01-17 01:57:29 +01:00
Victor Stinner
3e1fad6913
Rename _PyArg_ParseStack to _PyArg_ParseStackAndKeywords
...
Issue #29286 .
2017-01-17 01:29:01 +01:00
Victor Stinner
d526cfe546
type_prepare() now uses fast call (METH_FASTCALL)
2017-01-16 23:52:00 +01:00
Victor Stinner
69de71b255
Add _PyStack_AsTupleSlice() helper
2017-01-16 23:50:53 +01:00
Victor Stinner
7fc252adfb
Optimize _PyCFunction_FastCallKeywords()
...
Issue #29259 : Write fast path in _PyCFunction_FastCallKeywords() for
METH_FASTCALL, avoid the creation of a temporary dictionary for keyword
arguments.
Cleanup also _PyCFunction_FastCallDict():
* Don't dereference func before checking that it's not NULL
* Move code to raise the "no keyword argument" exception into a new
no_keyword_error label.
Update python-gdb.py for the change.
2017-01-16 17:18:53 +01:00
INADA Naoki
15f94596b6
Issue #20180 : forgot to update AC output.
2017-01-16 21:49:13 +09:00
INADA Naoki
3ae2056512
Issue #20180 : convert unicode methods to AC.
2017-01-16 20:41:20 +09:00
Martin Panter
446a498a63
Merge doc fixes from 3.6
2017-01-14 09:56:00 +00:00
Martin Panter
4659ddc433
Merge doc fixes from 3.5
2017-01-14 09:54:57 +00:00
Martin Panter
536d70ed33
Fix grammar, typos and markup in documentation and code comments
...
* Indent versionchanged at method level, not class level
* Mark up ``--help`` to avoid generating an en dash
* Use forward slash in Unix command line with a dollar sign ($) prompt
2017-01-14 08:23:08 +00:00
Martin Panter
94b39ceb73
Issue #1621 : Overflow should not be possible in listextend()
2017-01-14 06:30:37 +00:00
Serhiy Storchaka
617c7753ce
Issue #28969 : Fixed race condition in C implementation of functools.lru_cache.
...
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
2017-01-12 19:42:20 +02:00
Serhiy Storchaka
42e1ea9a10
Issue #28969 : Fixed race condition in C implementation of functools.lru_cache.
...
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
2017-01-12 19:12:21 +02:00
Serhiy Storchaka
67796521dd
Issue #28969 : Fixed race condition in C implementation of functools.lru_cache.
...
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
2017-01-12 18:34:33 +02: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
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
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
INADA Naoki
7ed28a8914
Merge 3.6
2017-01-06 17:44:43 +09:00
INADA Naoki
a634e23209
Issue #29159 : Fix regression in bytes(x) when x.__index__() raises Exception.
2017-01-06 17:32:01 +09:00
Victor Stinner
6f7c0ae46d
Issue #28839 : Optimize function_call()
...
function_call() now simply calls _PyFunction_FastCallDict().
_PyFunction_FastCallDict() is more efficient: it contains fast paths for the
common case (optimized code object and no keyword argument).
2017-01-03 01:58:17 +01:00
Stefan Krah
089a062da4
Merge 3.6.
2016-12-30 12:24:59 +01:00
Stefan Krah
a50006c977
Merge 3.5.
2016-12-30 12:24:23 +01:00
Stefan Krah
195319e6bb
Issue #29111 : Fix memoryview signature.
2016-12-30 12:23:35 +01:00
Serhiy Storchaka
c9ad8b7a23
Issue #29073 : bytearray formatting no longer truncates on first null byte.
2016-12-28 09:54:22 +02:00
Antoine Pitrou
c06ae208eb
Issue #28427 : old keys should not remove new values from
...
WeakValueDictionary when collecting from another thread.
2016-12-27 14:34:54 +01:00
Antoine Pitrou
d741ed492f
Issue #28427 : old keys should not remove new values from
...
WeakValueDictionary when collecting from another thread.
2016-12-27 14:23:43 +01:00
Antoine Pitrou
e10ca3a0fe
Issue #28427 : old keys should not remove new values from
...
WeakValueDictionary when collecting from another thread.
2016-12-27 14:19:20 +01:00
INADA Naoki
5a625d0aa6
Issue #29049 : Call _PyObject_GC_TRACK() lazily when calling Python function.
...
Calling function is up to 5% faster.
2016-12-24 20:19:08 +09:00
Xiang Zhang
62497d52d9
Issue #29044 : Merge 3.6.
2016-12-22 15:31:55 +08:00
Xiang Zhang
437a5d2c25
Issue #29044 : Merge 3.5.
2016-12-22 15:31:22 +08:00
Xiang Zhang
ea1cf87030
Issue #29044 : Fix a use-after-free in string '%c' formatter.
2016-12-22 15:30:47 +08:00
Xiang Zhang
b211068f5c
Issue #28822 : Adjust indices handling of PyUnicode_FindChar().
2016-12-20 22:52:33 +08:00
INADA Naoki
6165d55f13
Issue #28147 : Fix a memory leak in split-table dictionaries
...
setattr() must not convert combined table into split table.
2016-12-20 09:54:24 +09:00
Serhiy Storchaka
dd1da7f74a
Issue #28927 : bytes.fromhex() and bytearray.fromhex() now ignore all ASCII
...
whitespace, not only spaces. Patch by Robert Xiao.
2016-12-19 18:51:37 +02:00
Serhiy Storchaka
9d16b616d5
Issue #29000 : Fixed bytes formatting of octals with zero padding in alternate
...
form.
2016-12-17 22:15:10 +02:00
Serhiy Storchaka
025f8953f1
Issue #29000 : Fixed bytes formatting of octals with zero padding in alternate
...
form.
2016-12-17 22:13:05 +02:00
Serhiy Storchaka
b1a1619bf0
Issue #29000 : Fixed bytes formatting of octals with zero padding in alternate
...
form.
2016-12-17 21:48:03 +02:00
Serhiy Storchaka
5bb8b9134b
Issue #18896 : Python function can now have more than 255 parameters.
...
collections.namedtuple() now supports tuples with more than 255 elements.
2016-12-16 19:19:02 +02:00
Serhiy Storchaka
5ab81d787f
Issue #28959 : Added private macro PyDict_GET_SIZE for retrieving the size of dict.
2016-12-16 16:18:57 +02:00
Xavier de Gaye
31eaf49ed9
Merge 3.6.
2016-12-15 21:01:52 +01:00
Xavier de Gaye
76febd0792
Issue #26919 : On Android, operating system data is now always encoded/decoded
...
to/from UTF-8, instead of the locale encoding to avoid inconsistencies with
os.fsencode() and os.fsdecode() which are already using UTF-8.
2016-12-15 20:59:58 +01:00
Victor Stinner
5cc70c9935
Merge 3.6
2016-12-15 17:23:24 +01:00
Victor Stinner
3d3f264849
Fix a memory leak in split-table dictionaries
...
Issue #28147 : Fix a memory leak in split-table dictionaries: setattr() must not
convert combined table into split table.
Patch written by INADA Naoki.
2016-12-15 17:21:23 +01:00
Victor Stinner
944dbc6431
Use _PyDict_NewPresized() in _PyStack_AsDict()
...
Issue #27810 .
2016-12-15 16:59:40 +01:00
Victor Stinner
bc08ab4598
Add _PY_FASTCALL_SMALL_STACK constant
...
Issue #28870 : Add a new _PY_FASTCALL_SMALL_STACK constant, size of "small
stacks" allocated on the C stack to pass positional arguments to
_PyObject_FastCall().
_PyObject_Call_Prepend() now uses a small stack of 5 arguments (40 bytes)
instead of 8 (64 bytes), since it is modified to use _PY_FASTCALL_SMALL_STACK.
2016-12-15 12:40:53 +01:00
Victor Stinner
d1e35dd9ee
Fix _PyObject_CallFunctionVa(), use the small stack
...
Issue #28915 . Oops, I disabled the small stack to test both code paths. It's
now fixed.
2016-12-15 12:36:50 +01:00
Serhiy Storchaka
bdfc5ff17e
Merge from 3.6.
2016-12-14 19:56:53 +02:00
Serhiy Storchaka
386072ebe0
Merge from 3.6.
2016-12-14 19:54:38 +02:00
Serhiy Storchaka
49010ee323
Revert changeset 1f31bf3f76f5 (issue5322) except tests.
2016-12-14 19:52:17 +02:00
Yury Selivanov
f2392133eb
Issue #26110 : Add LOAD_METHOD/CALL_METHOD opcodes.
...
Special thanks to INADA Naoki for pushing the patch through
the last mile, Serhiy Storchaka for reviewing the code, and to
Victor Stinner for suggesting the idea (originally implemented
in the PyPy project).
2016-12-13 19:03:51 -05:00
Martin Panter
9bcaa37e1c
Issue #28820 : Merge typo fixes from 3.6
2016-12-10 05:39:12 +00:00
Martin Panter
186b204997
Fix typos in comment and documentation
2016-12-10 05:32:55 +00:00
Victor Stinner
59a73276e9
Backed out changeset 99c34e47348b
...
The change broke test_gdb.
2016-12-09 18:51:13 +01:00
Victor Stinner
0ca246c5e7
Inline PyEval_EvalFrameEx() in callers
...
The PEP 523 modified PyEval_EvalFrameEx(): it's now an indirection to
interp->eval_frame().
Inline the call in performance critical code. Leave PyEval_EvalFrame()
unchanged, this function is only kept for backward compatibility.
2016-12-09 17:12:17 +01:00
Victor Stinner
14e6d09547
Remove useless variable initialization
...
Don't initialize variables which are not used before they are assigned.
2016-12-09 17:08:59 +01:00
Victor Stinner
5abaa2b139
Use PyObject_CallFunctionObjArgs()
...
Issue #28915 : Replace PyObject_CallFunction() with
PyObject_CallFunctionObjArgs() when the format string was only made of "O"
formats, PyObject* arguments.
PyObject_CallFunctionObjArgs() avoids the creation of a temporary tuple and
doesn't have to parse a format string.
2016-12-09 16:22:32 +01:00
Victor Stinner
887b4307b6
Use _PyObject_FastCallVa() in type slots
...
Issue #28915 : Replace Py_VaBuildValue()+PyObject_Call() with
_PyObject_FastCallVa() to avoid the creation of temporary tuple.
2016-12-09 00:41:46 +01:00
Victor Stinner
7f39c0ccfc
Add _PyObject_VaCallFunctionObjArgs() private function
...
Issue #28915 : Similar to _PyObject_CallFunctionObjArgs() but use va_list to
pass arguments.
2016-12-09 00:40:33 +01:00
Victor Stinner
7e42541d08
Use _PyObject_CallMethodIdObjArgs()
...
Issue #28915 : Replace _PyObject_CallMethodId() with
_PyObject_CallMethodIdObjArgs() when the format string only use the format 'O'
for objects, like "(O)".
_PyObject_CallMethodIdObjArgs() avoids the code to parse a format string and
avoids the creation of a temporary tuple.
2016-12-09 00:36:19 +01:00
Victor Stinner
ef7def94c7
_PyObject_CallFunctionVa() uses fast call
...
Issue #28915 : Use _Py_VaBuildStack() to build a C array of PyObject* and then
use _PyObject_FastCall().
The function has a special case if the stack only contains one parameter and
the parameter is a tuple: "unpack" the tuple of arguments in this case.
2016-12-09 00:31:47 +01:00
Victor Stinner
e83aab12b0
Add _PyObject_CallFunctionVa() helper
...
Issue #28915 : Add _PyObject_CallFunctionVa() helper to factorize code of
functions:
* PyObject_CallFunction()
* _PyObject_CallFunction_SizeT()
* callmethod()
2016-12-09 00:22:56 +01:00
Victor Stinner
3bb711998d
Add _PyObject_FastCallVa() helper
...
Issue #28915 : Add _PyObject_FastCallVa() helper to factorize code of functions:
* PyObject_CallFunctionObjArgs()
* PyObject_CallMethodObjArgs()
* _PyObject_CallMethodIdObjArgs()
Inline objargs_mkstack() into _PyObject_FastCallVa(), remove
objargs_mkstack().
2016-12-09 00:21:55 +01:00
INADA Naoki
ba6097734d
Issue #28818 : Simplify lookdict functions
2016-12-07 20:41:42 +09:00
Serhiy Storchaka
1b58d8aafa
Issue #5322 : Fixed setting __new__ to a PyCFunction inside Python code.
...
Original patch by Andreas Stührk.
2016-12-07 11:27:55 +02:00
Serhiy Storchaka
0c78634d78
Issue #5322 : Fixed setting __new__ to a PyCFunction inside Python code.
...
Original patch by Andreas Stührk.
2016-12-07 11:26:49 +02:00
Victor Stinner
f2d568ff95
_PyObject_FastCallKeywords() now calls directly tp_call
...
_PyObject_FastCallKeywords() doesn't call _PyObject_FastCallDict() anymore:
call directly tp_call.
2016-12-07 00:37:38 +01:00
Victor Stinner
2f35ca3e84
Fix typo in a comment of abstract.c
2016-12-06 18:49:15 +01:00
Victor Stinner
f17c3de263
Use _PyObject_CallNoArg()
...
Replace:
PyObject_CallFunctionObjArgs(callable, NULL)
with:
_PyObject_CallNoArg(callable)
2016-12-06 18:46:19 +01:00
Victor Stinner
a5ed5f000a
Use _PyObject_CallNoArg()
...
Replace:
PyObject_CallObject(callable, NULL)
with:
_PyObject_CallNoArg(callable)
2016-12-06 18:45:50 +01:00
Victor Stinner
2d0eb65f45
Uniformize argument names of "call" functions
...
Issue #28838 : Rename parameters of the "calls" functions of the Python C API.
* Rename 'callable_object' and 'func' to 'callable': any Python callable object
is accepted, not only Python functions
* Rename 'method' and 'nameid' to 'name' (method name)
* Rename 'o' to 'obj'
* Move, fix and update documentation of PyObject_CallXXX() functions
in abstract.h
* Update also the documentaton of the C API (update parameter names)
2016-12-06 16:27:24 +01:00
Serhiy Storchaka
fb3134f4d4
Issue #28808 : PyUnicode_CompareWithASCIIString() now never raises exceptions.
2016-12-06 00:20:26 +02:00
Serhiy Storchaka
9a953dbb34
Issue #28808 : PyUnicode_CompareWithASCIIString() now never raises exceptions.
2016-12-06 00:17:45 +02:00
Serhiy Storchaka
419967b832
Issue #28808 : PyUnicode_CompareWithASCIIString() now never raises exceptions.
2016-12-06 00:13:34 +02:00
Victor Stinner
9083eb6aac
Use directly _PyObject_GenericSetAttrWithDict()
...
Modify type_setattro() to call directly _PyObject_GenericSetAttrWithDict()
instead of PyObject_GenericSetAttr().
PyObject_GenericSetAttr() is a thin wrapper to
_PyObject_GenericSetAttrWithDict().
2016-12-05 18:23:27 +01:00
Victor Stinner
7bfb42d5b7
Issue #28858 : Remove _PyObject_CallArg1() macro
...
Replace
_PyObject_CallArg1(func, arg)
with
PyObject_CallFunctionObjArgs(func, arg, NULL)
Using the _PyObject_CallArg1() macro increases the usage of the C stack, which
was unexpected and unwanted. PyObject_CallFunctionObjArgs() doesn't have this
issue.
2016-12-05 17:04:32 +01:00
Nick Coghlan
d77e5b7211
Merge #23722 from 3.6
2016-12-05 16:59:22 +10:00
Nick Coghlan
19d246745d
Issue #23722 : improve __classcell__ compatibility
...
Handling zero-argument super() in __init_subclass__ and
__set_name__ involved moving __class__ initialisation to
type.__new__. This requires cooperation from custom
metaclasses to ensure that the new __classcell__ entry
is passed along appropriately.
The initial implementation of that change resulted in abruptly
broken zero-argument super() support in metaclasses that didn't
adhere to the new requirements (such as Django's metaclass for
Model definitions).
The updated approach adopted here instead emits a deprecation
warning for those cases, and makes them work the same way they
did in Python 3.5.
This patch also improves the related class machinery documentation
to cover these details and to include more reader-friendly
cross-references and index entries.
2016-12-05 16:47:55 +10:00
Victor Stinner
de4ae3d486
Backed out changeset b9c9691c72c5
...
Issue #28858 : The change b9c9691c72c5 introduced a regression. It seems like
_PyObject_CallArg1() uses more stack memory than
PyObject_CallFunctionObjArgs().
2016-12-04 22:59:09 +01:00
Serhiy Storchaka
5adfac2c1b
Issue #5322 : Fixed setting __new__ to a PyCFunction inside Python code.
...
Original patch by Andreas Stührk.
2016-12-02 08:42:43 +02:00
Victor Stinner
4778eab1f2
Replace PyObject_CallFunction() with fastcall
...
Replace
PyObject_CallFunction(func, "O", arg)
and
PyObject_CallFunction(func, "O", arg, NULL)
with
_PyObject_CallArg1(func, arg)
Replace
PyObject_CallFunction(func, NULL)
with
_PyObject_CallNoArg(func)
_PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate
memory on the C stack.
2016-12-01 14:51:04 +01:00
Victor Stinner
27580c1fb5
Replace PyObject_CallFunctionObjArgs() with fastcall
...
* PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func)
* PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg)
PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires
extra work to "parse" C arguments to build a C array of PyObject*.
_PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate
memory on the C stack.
This change is part of the fastcall project. The change on listsort() is
related to the issue #23507 .
2016-12-01 14:43:22 +01:00
Victor Stinner
8be1c39eb3
Backed out changeset 7efddbf1aa70
2016-11-30 12:10:54 +01:00
Victor Stinner
ebea9988e0
Uniformize argument names of "call" functions
...
* Callable object: callable, o, callable_object => func
* Object for method calls: o => obj
* Method name: name or nameid => method
Cleanup also the C code:
* Don't initialize variables to NULL if they are not used before their first
assignement
* Add braces for readability
2016-11-29 18:47:56 +01:00
Serhiy Storchaka
baa7223bcd
Issue #28797 : Modifying the class __dict__ inside the __set_name__ method of
...
a descriptor that is used inside that class no longer prevents calling the
__set_name__ method of other descriptors.
2016-11-29 09:56:07 +02:00
Serhiy Storchaka
9ec07721f4
Issue #28797 : Modifying the class __dict__ inside the __set_name__ method of
...
a descriptor that is used inside that class no longer prevents calling the
__set_name__ method of other descriptors.
2016-11-29 09:54:17 +02:00
Victor Stinner
ed6de7345e
Merge 3.6
2016-11-24 22:33:49 +01:00
Victor Stinner
f7d199ff32
Fix _PyGen_yf()
...
Issue #28782 : Fix a bug in the implementation ``yield from`` when checking
if the next instruction is YIELD_FROM. Regression introduced by WORDCODE
(issue #26647 ).
Reviewed by Serhiy Storchaka and Yury Selivanov.
2016-11-24 22:33:01 +01:00
Serhiy Storchaka
99250d5c63
Issue #28774 : Simplified encoding a str result of an error handler in ASCII
...
and Latin1 encoders.
2016-11-23 15:13:00 +02:00
Xiang Zhang
d04d8474df
Issue #28774 : Fix start/end pos in unicode_encode_ucs1().
...
Fix error position of the unicode error in ASCII and Latin1
encoders when a string returned by the error handler contains multiple
non-encodable characters (non-ASCII for the ASCII codec, characters out
of the U+0000-U+00FF range for Latin1).
2016-11-23 19:34:01 +08:00
INADA Naoki
2c5a830f2a
Issue #28731 : Optimize _PyDict_NewPresized() to create correct size dict.
...
Improve speed of dict literal with constant keys up to 30%.
2016-12-07 18:34:44 +09:00
Serhiy Storchaka
007d7ff73f
Issue #28761 : The fields name and doc of structures PyMemberDef, PyGetSetDef,
...
PyStructSequence_Field, PyStructSequence_Desc, and wrapperbase are now of
type "const char *" rather of "char *".
2016-11-22 07:58:08 +02:00
INADA Naoki
92c50eee52
Issue #28731 : Optimize _PyDict_NewPresized() to create correct size dict
...
Improve speed of dict literal with constant keys up to 30%.
2016-11-22 00:57:02 +09:00
Serhiy Storchaka
50911476f5
Issue #28760 : Clean up and fix comments in PyUnicode_AsUnicodeEscapeString().
...
Patch by Xiang Zhang.
2016-11-21 11:47:16 +02:00
Serhiy Storchaka
ac0720eaa4
Issue #28760 : Clean up and fix comments in PyUnicode_AsUnicodeEscapeString().
...
Patch by Xiang Zhang.
2016-11-21 11:46:51 +02:00
Serhiy Storchaka
b57d9eac41
Issue #28748 : Private variable _Py_PackageContext is now of type "const char *"
...
rather of "char *".
2016-11-21 10:25:54 +02:00
Serhiy Storchaka
460bd0d284
Issue #19569 : Compiler warnings are now emitted if use most of deprecated
...
functions.
2016-11-20 12:16:46 +02:00
Serhiy Storchaka
85b0f5beb1
Added the const qualifier to char* variables that refer to readonly internal
...
UTF-8 represenatation of Unicode objects.
2016-11-20 10:16:47 +02:00
Serhiy Storchaka
a98c4a984b
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
...
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
2016-11-20 09:13:40 +02:00
Serhiy Storchaka
06515833fe
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
...
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
2016-11-20 09:13:07 +02:00
Yury Selivanov
bb2356500c
Merge 3.6 (issue #28721 )
2016-11-16 18:16:32 -05:00
Yury Selivanov
41782e4970
Issue #28721 : Fix asynchronous generators aclose() and athrow()
2016-11-16 18:16:17 -05:00
Serhiy Storchaka
27b74244fb
Issue #28701 : _PyUnicode_EqualToASCIIId and _PyUnicode_EqualToASCIIString now
...
require ASCII right argument and assert this condition in debug build.
2016-11-16 20:03:03 +02:00
Serhiy Storchaka
a83a6a3275
Issue #28701 : _PyUnicode_EqualToASCIIId and _PyUnicode_EqualToASCIIString now
...
require ASCII right argument and assert this condition in debug build.
2016-11-16 20:02:44 +02:00
Serhiy Storchaka
e6d6131f78
Fixed an off-by-one error in _PyUnicode_EqualToASCIIString (issue #28701 ).
2016-11-16 16:13:13 +02:00
Serhiy Storchaka
df66b9c425
Fixed an off-by-one error in _PyUnicode_EqualToASCIIString (issue #28701 ).
2016-11-16 16:12:56 +02:00
Serhiy Storchaka
292dd1b2ad
Fixed an off-by-one error in _PyUnicode_EqualToASCIIString (issue #28701 ).
2016-11-16 16:12:34 +02:00
Serhiy Storchaka
503db266a5
Issue #21449 : Removed private function _PyUnicode_CompareWithId.
2016-11-16 15:56:50 +02:00
Serhiy Storchaka
dddec81b2d
Issue #21449 : Removed private function _PyUnicode_CompareWithId.
2016-11-16 15:56:27 +02:00
Serhiy Storchaka
29a5447360
Issue #28701 : Replace _PyUnicode_CompareWithId with _PyUnicode_EqualToASCIIId.
...
The latter function is more readable, faster and doesn't raise exceptions.
Based on patch by Xiang Zhang.
2016-11-16 15:41:31 +02:00
Serhiy Storchaka
fab6acd9f5
Issue #28701 : Replace _PyUnicode_CompareWithId with _PyUnicode_EqualToASCIIId.
...
The latter function is more readable, faster and doesn't raise exceptions.
Based on patch by Xiang Zhang.
2016-11-16 15:41:11 +02:00
Serhiy Storchaka
f5894dd646
Issue #28701 : Replace _PyUnicode_CompareWithId with _PyUnicode_EqualToASCIIId.
...
The latter function is more readable, faster and doesn't raise exceptions.
Based on patch by Xiang Zhang.
2016-11-16 15:40:39 +02:00
Serhiy Storchaka
1a73bf365e
Issue #28701 : Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
...
The latter function is more readable, faster and doesn't raise exceptions.
2016-11-16 10:19:57 +02:00
Serhiy Storchaka
3b73ea1278
Issue #28701 : Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
...
The latter function is more readable, faster and doesn't raise exceptions.
2016-11-16 10:19:20 +02:00
Serhiy Storchaka
f4934ea77d
Issue #28701 : Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
...
The latter function is more readable, faster and doesn't raise exceptions.
2016-11-16 10:17:58 +02:00
Victor Stinner
c7a8f67411
Issue #28618 : Mark dict lookup functions as hot
...
It's common to see these functions in the top 3 of "perf report".
2016-11-15 15:13:40 +01:00
Serhiy Storchaka
616034eb73
Issue #28648 : Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
...
when decode astral characters.
2016-11-12 14:37:11 +02:00
Serhiy Storchaka
babe4f8e5e
Issue #28648 : Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
...
when decode astral characters.
2016-11-12 14:36:02 +02:00
Serhiy Storchaka
6b4b6e956e
Issue #28648 : Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
...
when decode astral characters.
2016-11-12 14:35:46 +02:00
Serhiy Storchaka
84293aff9f
Issue #28648 : Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
...
when decode astral characters.
2016-11-12 14:29:48 +02:00
Serhiy Storchaka
b626643734
Issue #28648 : Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
...
when decode astral characters.
2016-11-12 14:28:06 +02:00
Victor Stinner
c6944e7edc
Issue #28618 : Make hot functions using __attribute__((hot))
...
When Python is not compiled with PGO, the performance of Python on call_simple
and call_method microbenchmarks depend highly on the code placement. In the
worst case, the performance slowdown can be up to 70%.
The GCC __attribute__((hot)) attribute helps to keep hot code close to reduce
the risk of such major slowdown. This attribute is ignored when Python is
compiled with PGO.
The following functions are considered as hot according to statistics collected
by perf record/perf report:
* _PyEval_EvalFrameDefault()
* call_function()
* _PyFunction_FastCall()
* PyFrame_New()
* frame_dealloc()
* PyErr_Occurred()
2016-11-11 02:13:35 +01:00
Victor Stinner
0cae609847
Use PyThreadState_GET() in performance critical code
...
It seems like _PyThreadState_UncheckedGet() is not inlined as expected, even
when using gcc -O3.
2016-11-11 01:43:56 +01:00
Yury Selivanov
f787c90764
Merge 3.6 (issue #27942 )
2016-11-09 09:43:37 -05:00
Yury Selivanov
6c10650617
Merge 3.5 (issue #27942 )
2016-11-09 09:43:08 -05:00
Yury Selivanov
d2fd3599ab
ssue #27942 : Fix memory leak in codeobject.c
2016-11-09 09:42:14 -05:00
Yury Selivanov
9a2ffbd47c
Merge 3.6 (issue #28003 )
2016-11-08 19:46:41 -05:00
Yury Selivanov
29310c47a7
Issue #28003 : Make WrappedVal, ASend and AThrow GC types
2016-11-08 19:46:22 -05:00
Yury Selivanov
ff0273fb20
Merge 3.6
2016-11-08 19:20:08 -05:00
Yury Selivanov
49ffdf6bb2
Merge 3.5
2016-11-08 19:19:52 -05:00
Yury Selivanov
33499b7eed
genobject: Remove unnecessary tp_free slots from aiter_wrapper and coro_wrapper
2016-11-08 19:19:28 -05:00
Serhiy Storchaka
b2e64f903d
Issue #28621 : Sped up converting int to float by reusing faster bits counting
...
implementation. Patch by Adrian Wielgosik.
2016-11-08 20:34:22 +02:00
Steve Dower
257a4c1503
Closes #27781 : Removes special cases for the experimental aspect of PEP 529
2016-11-06 19:35:24 -08:00
Steve Dower
78057b4159
Closes #27781 : Removes special cases for the experimental aspect of PEP 529
2016-11-06 19:35:08 -08:00
Benjamin Peterson
6e9d6b9536
merge 3.6
2016-11-06 13:01:23 -08:00
Benjamin Peterson
3bd7900155
merge 3.5
2016-11-06 13:01:15 -08:00
Benjamin Peterson
db87c99444
make sure dict view types are initialized
2016-11-06 13:01:07 -08:00
Serhiy Storchaka
85bcf37e15
Issue #23996 : Added _PyGen_SetStopIterationValue for safe raising
...
StopIteration with value. More safely handle non-normalized exceptions
in -_PyGen_FetchStopIterationValue.
2016-11-06 18:47:35 +02:00
Serhiy Storchaka
60e49aa756
Issue #23996 : Added _PyGen_SetStopIterationValue for safe raising
...
StopIteration with value. More safely handle non-normalized exceptions
in -_PyGen_FetchStopIterationValue.
2016-11-06 18:47:03 +02:00
Serhiy Storchaka
24411f8a8d
Issue #23996 : Added _PyGen_SetStopIterationValue for safe raising
...
StopIteration with value. More safely handle non-normalized exceptions
in -_PyGen_FetchStopIterationValue.
2016-11-06 18:44:42 +02:00
Serhiy Storchaka
f0b311bd73
Issue #28123 : _PyDict_GetItem_KnownHash() now can raise an exception as
...
PyDict_GetItemWithError(). Patch by Xiang Zhang.
2016-11-06 13:18:24 +02:00
INADA Naoki
93f26f794d
Issue #28583 : PyDict_SetDefault didn't combine split table when needed.
...
Patch by Xiang Zhang.
2016-11-02 18:45:16 +09:00
Eric V. Smith
5646648678
Issue 28128: Print out better error/warning messages for invalid string escapes. Backport to 3.6.
2016-10-31 14:46:26 -04:00
Serhiy Storchaka
7f0514ad54
Backed out changeset 6b88dfc7b25d
2016-10-31 20:14:05 +02:00
Serhiy Storchaka
7984bff52a
Issue #28385 : An error message when non-empty format spec is passed to
...
object.__format__ now contains the name of actual type.
2016-10-30 19:37:46 +02:00
Serhiy Storchaka
d1af5effc2
Issue #28385 : An error message when non-empty format spec is passed to
...
object.__format__ now contains the name of actual type.
2016-10-30 19:33:54 +02:00
Serhiy Storchaka
998c9cdd42
Issue #28561 : Clean up UTF-8 encoder: remove dead code, update comments, etc.
...
Patch by Xiang Zhang.
2016-10-30 18:25:27 +02:00
Serhiy Storchaka
b7d14a09c2
Merge from 3.5.
2016-10-30 17:25:45 +02:00
Serhiy Storchaka
0438683939
Backed out changeset 9f7505019767 (issue #27275 ).
2016-10-30 17:17:24 +02:00
Serhiy Storchaka
e26e20db95
Issue #28199 : Microoptimized dict resizing. Based on patch by Naoki Inada.
2016-10-29 10:50:00 +03:00
Serhiy Storchaka
04230c4087
Issue #28123 : _PyDict_GetItem_KnownHash() now can raise an exception as
...
PyDict_GetItemWithError(). Patch by Xiang Zhang.
2016-11-06 13:19:38 +02:00
INADA Naoki
ca2d8be4ba
Issue #28580 : Optimize iterating split table values.
...
Patch by Xiang Zhang.
2016-11-04 16:59:10 +09:00
INADA Naoki
a3498c7569
Issue #28583 : PyDict_SetDefault didn't combine split table when needed.
...
Patch by Xiang Zhang.
2016-11-02 18:47:24 +09:00
Serhiy Storchaka
5e325d9c41
Merge from 3.6.
2016-10-31 20:15:48 +02:00
Eric V. Smith
42454af094
Issue 28128: Print out better error/warning messages for invalid string escapes.
2016-10-31 09:22:08 -04:00
Serhiy Storchaka
79879e002f
Issue #28385 : An error message when non-empty format spec is passed to
...
object.__format__ now contains the name of actual type.
2016-10-30 19:38:05 +02:00
Serhiy Storchaka
b982ae8317
Issue #28561 : Clean up UTF-8 encoder: remove dead code, update comments, etc.
...
Patch by Xiang Zhang.
2016-10-30 18:25:46 +02:00
Serhiy Storchaka
a182d7bc14
Merge from 3.6.
2016-10-30 17:27:40 +02:00
Serhiy Storchaka
041794908b
Issue #28199 : Microoptimized dict resizing. Based on patch by Naoki Inada.
2016-10-29 10:50:00 +03:00
Serhiy Storchaka
d76d8bfee1
Issue #28199 : Microoptimized dict resizing. Based on patch by Naoki Inada.
2016-10-29 10:49:43 +03:00
Yury Selivanov
f0bbee6228
Merge 3.6 (issue #28544 )
2016-10-28 19:01:46 -04:00
Yury Selivanov
684ef2c888
Issue #28544 : Pass `PyObject*` to _PyDict_Pop, not `PyDictObject*`
2016-10-28 19:01:21 -04:00
Serhiy Storchaka
2edcd1cba4
Issue #28426 : Deprecated undocumented functions PyUnicode_AsEncodedObject(),
...
PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and
PyUnicode_AsEncodedUnicode().
2016-10-27 21:08:00 +03:00
Serhiy Storchaka
0093907f0e
Issue #28426 : Deprecated undocumented functions PyUnicode_AsEncodedObject(),
...
PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and
PyUnicode_AsEncodedUnicode().
2016-10-27 21:05:49 +03:00
INADA Naoki
b574e77122
Issue #28509 : dict.update() no longer allocate unnecessary large memory
2016-10-27 19:30:10 +09:00
INADA Naoki
b1152be2de
Issue #28509 : dict.update() no longer allocate unnecessary large memory
2016-10-27 19:26:50 +09:00
Serhiy Storchaka
b3e5812300
Issue #27275 : Fixed implementation of pop() and popitem() methods in
...
subclasses of accelerated OrderedDict.
2016-10-25 15:38:28 +03:00
Serhiy Storchaka
1faf9025b5
Issue #27275 : Fixed implementation of pop() and popitem() methods in
...
subclasses of accelerated OrderedDict.
2016-10-25 15:36:56 +03:00
Serhiy Storchaka
4832580596
Issue #27275 : Fixed implementation of pop() and popitem() methods in
...
subclasses of accelerated OrderedDict.
2016-10-25 15:33:23 +03:00
Serhiy Storchaka
a4f8823063
Issue #28408 : Fixed a leak and remove redundant code in _PyUnicodeWriter_Finish().
...
Patch by Xiang Zhang.
2016-10-25 13:25:04 +03:00
Serhiy Storchaka
c8bc3d1c07
Issue #28408 : Fixed a leak and remove redundant code in _PyUnicodeWriter_Finish().
...
Patch by Xiang Zhang.
2016-10-25 13:23:56 +03:00
Serhiy Storchaka
d7e5ff13bb
Issue #28426 : Fixed potential crash in PyUnicode_AsDecodedObject() in debug build.
2016-10-25 10:18:16 +03:00
Serhiy Storchaka
c4a3e90aa8
Issue #28426 : Fixed potential crash in PyUnicode_AsDecodedObject() in debug build.
2016-10-25 10:17:33 +03:00
Serhiy Storchaka
839023f12c
Issue #28426 : Fixed potential crash in PyUnicode_AsDecodedObject() in debug build.
2016-10-25 10:13:43 +03:00
Serhiy Storchaka
77eede35fc
Issue #28426 : Fixed potential crash in PyUnicode_AsDecodedObject() in debug build.
2016-10-25 10:07:51 +03:00
Serhiy Storchaka
2fbc019c8c
Issue #28439 : Remove redundant checks in PyUnicode_EncodeLocale and
...
PyUnicode_DecodeLocaleAndSize. Patch by Xiang Zhang.
2016-10-23 15:41:36 +03:00
Serhiy Storchaka
f8d7d41507
Issue #28511 : Use the "U" format instead of "O!" in PyArg_Parse*.
2016-10-23 15:12:25 +03:00
Serhiy Storchaka
523c449ca0
Issue #28504 : Cleanup unicode_decode_call_errorhandler_wchar/writer.
...
Patch by Xiang Zhang.
2016-10-22 23:18:31 +03:00
Raymond Hettinger
b12785d456
Reference the original compact-and-ordered proposal
2016-10-22 09:58:14 -07:00
Serhiy Storchaka
c4b4d4e2d8
Issue #28214 : Improved exception reporting for problematic __set_name__
...
attributes.
2016-10-21 17:15:20 +03:00
Serhiy Storchaka
d5d32d2127
Issue #28214 : Improved exception reporting for problematic __set_name__
...
attributes.
2016-10-21 17:13:31 +03:00
Serhiy Storchaka
14ab277632
Issue #28410 : Added _PyErr_FormatFromCause() -- the helper for raising
...
new exception with setting current exception as __cause__.
_PyErr_FormatFromCause(exception, format, args...) is equivalent to Python
raise exception(format % args) from sys.exc_info()[1]
2016-10-21 17:10:42 +03:00
Serhiy Storchaka
467ab194fc
Issue #28410 : Added _PyErr_FormatFromCause() -- the helper for raising
...
new exception with setting current exception as __cause__.
_PyErr_FormatFromCause(exception, format, args...) is equivalent to Python
raise exception(format % args) from sys.exc_info()[1]
2016-10-21 17:09:17 +03:00
Benjamin Peterson
d6d49f16f4
merge 3.6 ( #28454 )
2016-10-16 15:42:33 -07:00
Benjamin Peterson
3aa75528a1
merge 3.5 ( #28454 )
2016-10-16 15:42:24 -07:00
Benjamin Peterson
8d761ff045
remove extra PyErr_Format arguments ( closes #28454 )
...
Patch from Xiang Zhang.
2016-10-16 15:41:46 -07:00
Christian Heimes
e590a03db7
Check return value of _PyDict_SetItemId()
2016-10-13 21:10:42 +02:00
Christian Heimes
5cade88ac1
Check return value of _PyDict_SetItemId()
2016-10-13 21:10:31 +02:00
Victor Stinner
5a33759fba
Merge 3.6
2016-10-12 13:59:13 +02:00
Victor Stinner
ebe17e0347
Fix _Py_normalize_encoding() command
...
It's not exactly the same than encodings.normalize_encoding(): the C function
also converts to lowercase.
2016-10-12 13:57:45 +02:00
Benjamin Peterson
8a3748290a
merge 3.6 ( #28417 )
2016-10-11 23:01:12 -07:00
Benjamin Peterson
b329e1bb5b
va_end vargs2 once ( closes #28417 )
2016-10-11 23:00:58 -07:00
doko@ubuntu.com
de69ee71e2
- dictobject.c: Make dict_merge symbol a static symbol
2016-10-11 08:04:02 +02:00
doko@ubuntu.com
c96df68ea3
- dictobject.c: Make dict_merge symbol a static symbol
2016-10-11 08:04:02 +02:00
Serhiy Storchaka
2e58f1a52a
Issue #28400 : Removed uncessary checks in unicode_char and resize_copy.
...
1. In resize_copy we don't need to PyUnicode_READY(unicode) since when
it's not PyUnicode_WCHAR_KIND it should be ready.
2. In unicode_char, PyUnicode_1BYTE_KIND is handled by get_latin1_char.
Patch by Xiang Zhang.
2016-10-09 23:44:48 +03:00
Serhiy Storchaka
1aa85a9eea
Merge from 3.6.
2016-10-09 23:08:58 +03:00
Serhiy Storchaka
49f5cdde1a
Issue #28183 : Optimize and cleanup dict iteration.
2016-10-09 23:08:05 +03:00
Serhiy Storchaka
74a7e3b981
Merge from 3.6.
2016-10-08 22:48:07 +03:00
Serhiy Storchaka
21d9f10c94
Merge from 3.5.
2016-10-08 22:46:01 +03:00
Serhiy Storchaka
9c0e1f83af
Issue #28379 : Added sanity checks and tests for PyUnicode_CopyCharacters().
...
Patch by Xiang Zhang.
2016-10-08 22:45:38 +03:00
Serhiy Storchaka
df53392f0d
Issue #28376 : Creating instances of range_iterator by calling range_iterator
...
type now is disallowed. Calling iter() on range instance is the only way.
Patch by Oren Milman.
2016-10-08 22:01:18 +03:00
Serhiy Storchaka
aa078674e0
Merge with 3.6.
2016-10-08 21:52:41 +03:00
Serhiy Storchaka
c7f490c8b1
Issue #28376 : Creating instances of range_iterator by calling range_iterator
...
type now is deprecated. Patch by Oren Milman.
2016-10-08 21:50:45 +03:00
Serhiy Storchaka
639098c591
Merge from 3.5.
2016-10-08 21:45:07 +03:00
Serhiy Storchaka
44759bcf13
Issue #28376 : The constructor of range_iterator now checks that step is not 0.
...
Patch by Oren Milman.
2016-10-08 21:43:11 +03:00
Serhiy Storchaka
a94ed55dbd
Issue #26906 : Resolving special methods of uninitialized type now causes
...
implicit initialization of the type instead of a fail.
2016-10-08 12:28:25 +03:00
Serhiy Storchaka
56588b7055
Issue #26906 : Resolving special methods of uninitialized type now causes
...
implicit initialization of the type instead of a fail.
2016-10-08 12:26:25 +03:00
Serhiy Storchaka
8ef34600c7
Issue #26906 : Resolving special methods of uninitialized type now causes
...
implicit initialization of the type instead of a fail.
2016-10-08 12:24:09 +03:00
Serhiy Storchaka
52597d91e2
Issue #18287 : PyType_Ready() now checks that tp_name is not NULL.
...
Original patch by Niklas Koep.
2016-10-07 23:26:16 +03:00
Serhiy Storchaka
e45b7c09ec
Issue #18287 : PyType_Ready() now checks that tp_name is not NULL.
...
Original patch by Niklas Koep.
2016-10-07 23:25:46 +03:00
Serhiy Storchaka
de0574bdab
Issue #18287 : PyType_Ready() now checks that tp_name is not NULL.
...
Original patch by Niklas Koep.
2016-10-07 23:24:35 +03:00
INADA Naoki
ecdd36ff88
Issue #28201 : Dict reduces possibility of 2nd conflict in hash table.
...
Do perturb shift after first conflict.
2016-10-06 15:22:28 +09:00
INADA Naoki
267941c675
Issue #28201 : Dict reduces possibility of 2nd conflict in hash table.
...
Do perturb shift after first conflict.
2016-10-06 15:19:07 +09:00
Serhiy Storchaka
7fd9f4b458
Merge heads
2016-10-04 18:23:55 +03:00
Serhiy Storchaka
a67e5cad1d
Issue #28350 : String constants with null character no longer interned.
2016-10-04 18:21:53 +03:00
Serhiy Storchaka
e81b0d335b
Issue #28350 : String constants with null character no longer interned.
2016-10-04 18:21:25 +03:00
Serhiy Storchaka
09f3d080fe
Issue #28350 : String constants with null character no longer interned.
2016-10-04 18:17:22 +03:00
Benjamin Peterson
b983b8de9d
merge 3.6 ( #26617 )
2016-10-04 00:00:35 -07:00
Benjamin Peterson
804480912c
merge 3.5 ( #26617 )
2016-10-04 00:00:23 -07:00
Benjamin Peterson
8f657c35b9
ensure gc tracking is off when invoking weakref callbacks ( closes #26617 )
2016-10-04 00:00:02 -07:00
Serhiy Storchaka
2e84de3638
Issue #27358 : Optimized merging var-keyword arguments and improved error
...
message when pass a non-mapping as a var-keyword argument.
2016-10-02 11:07:29 +03:00
Serhiy Storchaka
e036ef8fa2
Issue #27358 : Optimized merging var-keyword arguments and improved error
...
message when pass a non-mapping as a var-keyword argument.
2016-10-02 11:06:43 +03:00
Serhiy Storchaka
be9cddb302
Issue #27942 : String constants now interned recursively in tuples and frozensets.
2016-09-30 10:36:15 +03:00
Serhiy Storchaka
3738c2d8ae
Issue #27942 : String constants now interned recursively in tuples and frozensets.
2016-09-30 10:23:01 +03:00
Serhiy Storchaka
00a0fc1144
Issue #27942 : String constants now interned recursively in tuples and frozensets.
2016-09-30 10:07:26 +03:00
Serhiy Storchaka
e9e44484a5
Issue #28289 : ImportError.__init__ now resets not specified attributes.
2016-09-28 07:53:32 +03:00
Serhiy Storchaka
a6f035ee8d
Issue #21578 : Fixed misleading error message when ImportError called with
...
invalid keyword args.
2016-09-27 20:51:27 +03:00
Serhiy Storchaka
389ef9dcda
Issue #21578 : Fixed misleading error message when ImportError called with
...
invalid keyword args.
2016-09-27 20:51:04 +03:00
Serhiy Storchaka
47dee11ba7
Issue #21578 : Fixed misleading error message when ImportError called with
...
invalid keyword args.
2016-09-27 20:45:35 +03:00
Serhiy Storchaka
60b270f44b
Issue #27914 : Fixed a comment in PyModule_ExcDef.
...
Patch by Xiang Zhang.
2016-09-26 23:15:04 +03:00
Serhiy Storchaka
333ad92ec2
Issue #27914 : Fixed a comment in PyModule_ExcDef.
...
Patch by Xiang Zhang.
2016-09-26 23:14:44 +03:00
Serhiy Storchaka
a9fc458b77
issue #28144 : Decrease empty_keys_struct's dk_refcnt
...
since there is no dummy_struct any more.
Patch by Xiang Zhang.
2016-09-26 23:01:42 +03:00
Serhiy Storchaka
97932e4c4f
issue #28144 : Decrease empty_keys_struct's dk_refcnt
...
since there is no dummy_struct any more.
Patch by Xiang Zhang.
2016-09-26 23:01:23 +03:00
Serhiy Storchaka
9ac73c2052
Issue #28194 : Clean up some checks in dict implementation.
...
Patch by Xiang Zhang.
2016-09-26 21:29:58 +03:00
Serhiy Storchaka
46825d2399
Issue #28194 : Clean up some checks in dict implementation.
...
Patch by Xiang Zhang.
2016-09-26 21:29:34 +03:00
Mark Dickinson
3992d6e5e1
Issue #28203 : Merge from 3.6
2016-09-24 15:29:07 +01:00
Mark Dickinson
6997946ec4
Issue #28203 : Merge from 3.5
2016-09-24 15:28:34 +01:00
Mark Dickinson
613f8e513c
Issue #28203 : Fix incorrect type in error message from complex(1.0, {2:3}). Patch by Soumya Sharma.
2016-09-24 15:26:36 +01:00
Benjamin Peterson
40b41fa531
merge 3.6
2016-09-22 23:40:08 -07:00
Benjamin Peterson
7b7228a709
remove unneeded cast
2016-09-22 23:39:59 -07:00
Serhiy Storchaka
cf4fb40b9d
Issue #28214 : Now __set_name__ is looked up on the class instead of the
...
instance.
2016-09-21 15:55:49 +03:00
Serhiy Storchaka
afd02a439f
Issue #28214 : Now __set_name__ is looked up on the class instead of the
...
instance.
2016-09-21 15:54:59 +03:00
Victor Stinner
71276144bd
Merge 3.6
2016-09-21 14:14:59 +02:00
Victor Stinner
44f4874e68
Merge 3.5
2016-09-21 14:13:53 +02:00
Victor Stinner
1ddf53d496
Fix PyUnicode_FromFormatV() error handling
...
Issue #28233 : Fix a memory leak if the format string contains a non-ASCII
character, destroy the unicode writer.
2016-09-21 14:13:14 +02:00
Christian Heimes
e5ad75e242
va_end() all va_copy()ed va_lists.
2016-09-21 11:37:38 +02:00
Christian Heimes
2f2fee19ec
va_end() all va_copy()ed va_lists.
2016-09-21 11:37:27 +02:00
Benjamin Peterson
637d1e2b0a
merge 3.6
2016-09-20 20:39:44 -07:00
Benjamin Peterson
0c21214f3e
replace usage of Py_VA_COPY with the (C99) standard va_copy
2016-09-20 20:39:33 -07:00
Raymond Hettinger
2113c6e41b
merge
2016-09-18 21:46:34 -07:00
Raymond Hettinger
6692f01c91
merge
2016-09-18 21:46:08 -07:00
Raymond Hettinger
7eb1becc25
Issue #28189 : dictitems_contains no longer swallows compare errors.
...
(Patch by Xiang Zhang)
2016-09-18 21:45:11 -07:00
Benjamin Peterson
f820836e6c
merge 3.6
2016-09-18 19:25:00 -07:00
Benjamin Peterson
5d4b09c106
correct silly spelling problem
2016-09-18 19:24:52 -07:00
Benjamin Peterson
beb6cf6822
merge 3.6
2016-09-18 19:22:27 -07:00
Benjamin Peterson
19517e4da7
replace obmalloc's homegrown uptr and uchar types with standard ones
2016-09-18 19:22:22 -07:00
Benjamin Peterson
630783d811
merge 3.6
2016-09-18 19:19:38 -07:00
Benjamin Peterson
3924f93794
improvements to code that checks whether Python (obmalloc) allocated an address
...
- Rename Py_ADDRESS_IN_RANGE to address_in_range and make it a static
function instead of macro. Any compiler worth its salt will inline this
function.
- Remove the duplicated function version of Py_ADDRESS_IN_RANGE used when memory
analysis was active. Instead, we can simply mark address_in_range as allergic
to dynamic memory checking. We can now remove the
__attribute__((no_address_safety_analysis)) from _PyObject_Free and
_PyObject_Realloc. All the badness is contained in address_in_range now.
- Fix the code that tried to only read pool->arenaindex once. Putting something
in a variable is no guarantee that it won't be read multiple times. We must
use volatile for that.
2016-09-18 19:12:48 -07:00
Mark Dickinson
c1c4a64edb
Issue #27111 : Minor simplication to long_add and long_sub fast path code. Thanks Oren Milman.
2016-09-17 20:01:56 +01:00
Mark Dickinson
fba121fe9d
Issue #27441 : Remove some redundant assignments to ob_size in longobject.c. Thanks Oren Milman.
2016-09-17 19:44:13 +01:00
Mark Dickinson
92ca535626
Issue #27222 : various cleanups in long_rshift. Thanks Oren Milman.
2016-09-17 17:50:50 +01:00
Martin Panter
d508d00919
Issue #28139 : Merge indentation fixes from 3.5 into 3.6
2016-09-17 07:59:14 +00:00
Martin Panter
6d57fe1c23
Issue #28139 : Fix messed up indentation
...
Also update the classmethod and staticmethod doc strings and comments to
match the RST documentation.
2016-09-17 03:26:16 +00:00
Berker Peksag
7b4bcd2004
Issue #25270 : Merge from 3.5
2016-09-16 17:32:06 +03:00
Berker Peksag
4a72a7b6c4
Issue #25270 : Prevent codecs.escape_encode() from raising SystemError when an empty bytestring is passed
2016-09-16 17:31:06 +03:00
Benjamin Peterson
6775231597
Unicode 9.0.0
...
Not completely mechanical since support for East Asian Width changes—emoji
codepoints became Wide—had to be added to unicodedata.
2016-09-14 23:53:47 -07:00
Victor Stinner
611b0fa94c
Add _PyDict_CheckConsistency()
...
Issue #28127 : Add a function to check that a dictionary remains consistent
after any change.
By default, tables are not checked, only basic attributes. Define DEBUG_PYDICT
(ex: gcc -D DEBUG_PYDICT) to also check dictionary "content".
2016-09-14 15:02:01 +02:00
Christian Heimes
f051e43b22
Issue #28126 : Replace Py_MEMCPY with memcpy(). Visual Studio can properly optimize memcpy().
2016-09-13 20:22:02 +02:00
Victor Stinner
d0ad11f6b4
Fix _PyDict_Pop() on pending key
...
Issue #28120 : Fix dict.pop() for splitted dictionary when trying to remove a
"pending key" (Not yet inserted in split-table).
Patch by Xiang Zhang.
2016-09-13 16:56:38 +02:00
Victor Stinner
9926480b6a
Issue #28040 : Cleanup find_empty_slot()
...
find_empty_slot() only supports combined dict
2016-09-13 09:38:29 +02:00
Victor Stinner
476bd5ea97
Fix warning in _PyCFunction_FastCallKeywords()
...
Issue #28105 .
2016-09-12 15:33:26 -04:00
Victor Stinner
3c336c5915
Issue #28077 : find_empty_slot() only supports combined dict
2016-09-12 14:17:40 +02:00
Victor Stinner
57f91ac95a
Document kwnames in _PyObject_FastCallKeywords() and _PyStack_AsDict()
...
Issue #27213 .
2016-09-12 13:37:07 +02:00
Victor Stinner
b8d768b019
Revert change f860b7a775c5
...
Revert change "Issue #27213 : Reintroduce checks in _PyStack_AsDict()", pushed
by mistake.
2016-09-12 13:30:02 +02:00
Victor Stinner
b1e169bf4b
ssue #27213 : Reintroduce checks in _PyStack_AsDict()
2016-09-12 12:55:28 +02:00
Raymond Hettinger
4103e4dfbc
Issue #28071 : Add early-out for differencing from an empty set.
2016-09-11 22:02:28 -07:00
Berker Peksag
1d7feab78a
Issue #28045 : Merge from 3.5
2016-09-12 07:47:33 +03:00
Berker Peksag
ed6224ee0c
Issue #28045 : Fix comment in range_contains_long()
...
Patch by wim glenn.
2016-09-12 07:47:04 +03:00
Serhiy Storchaka
b72810583e
Issue #27213 : Fixed different issues with reworked CALL_FUNCTION* opcodes.
...
* BUILD_TUPLE_UNPACK and BUILD_MAP_UNPACK_WITH_CALL no longer generated with
single tuple or dict.
* Restored more informative error messages for incorrect var-positional and
var-keyword arguments.
* Removed code duplications in _PyEval_EvalCodeWithName().
* Removed redundant runtime checks and parameters in _PyStack_AsDict().
* Added a workaround and enabled previously disabled test in test_traceback.
* Removed dead code from the dis module.
2016-09-12 00:52:40 +03:00
Serhiy Storchaka
ab8740058a
Issue #27129 : Replaced wordcode related magic constants with macros.
2016-09-11 13:48:15 +03:00
Nick Coghlan
944368e1cc
Issue #23722 : Initialize __class__ from type.__new__()
...
The __class__ cell used by zero-argument super() is now initialized
from type.__new__ rather than __build_class__, so class methods
relying on that will now work correctly when called from metaclass
methods during class creation.
Patch by Martin Teichmann.
2016-09-11 14:45:49 +10:00
Mark Dickinson
82cb124300
Issue #25221 : merge from 3.5.
2016-09-10 20:20:08 +01:00
Mark Dickinson
36820dd5a9
Issue #25221 : Fix corrupted result from PyLong_FromLong(0) when Python is compiled with NSMALLPOSINTS = 0.
2016-09-10 20:17:36 +01:00
Serhiy Storchaka
473e0e4dba
Fixed compiler warnings in compact dict implementation on 32-bit platforms.
2016-09-10 21:34:43 +03:00
Victor Stinner
990397ef1e
dictobject.c: explain why stringlib is used
2016-09-09 20:22:59 -07:00
Victor Stinner
37e4ef7b17
Issue #27810 : Rerun Argument Clinic on all modules
2016-09-09 20:00:13 -07:00
Victor Stinner
a9efb2f56e
Add METH_FASTCALL calling convention
...
Issue #27810 : Add a new calling convention for C functions:
PyObject* func(PyObject *self, PyObject **args,
Py_ssize_t nargs, PyObject *kwnames);
Where args is a C array of positional arguments followed by values of keyword
arguments. nargs is the number of positional arguments, kwnames are keys of
keyword arguments. kwnames can be NULL.
2016-09-09 17:40:22 -07:00
Victor Stinner
78601a38c2
Fix SystemError in compact dict
...
Issue #28040 : Fix _PyDict_DelItem_KnownHash() and _PyDict_Pop(): convert
splitted table to combined table to be able to delete the item.
Write an unit test for the issue.
Patch by INADA Naoki.
2016-09-09 19:28:36 -07:00
Brett Cannon
a721abac29
Issue #26331 : Implement the parsing part of PEP 515.
...
Thanks to Georg Brandl for the patch.
2016-09-09 14:57:09 -07:00
Serhiy Storchaka
7c19affdce
Issue #25856 : The __module__ attribute of extension classes and functions
...
now is interned. This leads to more compact pickle data with protocol 4.
2016-09-10 00:53:02 +03:00
Victor Stinner
ae8b69c410
Issue #27810 : Add _PyCFunction_FastCallKeywords()
...
Use _PyCFunction_FastCallKeywords() in ceval.c: it allows to remove a lot of
code from ceval.c which was only used to call C functions.
2016-09-09 14:07:44 -07:00
Benjamin Peterson
621b430a14
remove all usage of Py_LOCAL
2016-09-09 13:54:34 -07:00
Victor Stinner
d873572095
Add _PyObject_FastCallKeywords()
...
Issue #27830 : Add _PyObject_FastCallKeywords(): avoid the creation of a
temporary dictionary for keyword arguments.
Other changes:
* Cleanup call_function() and fast_function() (ex: rename nk to nkwargs)
* Remove now useless do_call(), replaced with _PyObject_FastCallKeywords()
2016-09-09 12:36:44 -07:00
Benjamin Peterson
6cb526e54d
remove unconvincing use of Py_LOCAL
2016-09-09 12:42:51 -07:00
Eric Snow
06aed90a1f
Issue #27576 : Fix call order in OrderedDict.__init__().
2016-09-09 11:59:08 -07:00
Yury Selivanov
eb6364557f
Issue #28003 : Implement PEP 525 -- Asynchronous Generators.
2016-09-08 22:01:51 -07:00
Berker Peksag
71c01d43a7
Issue #28033 : Fix typo in dictobject.c
...
Patch by Wesley Emeneker.
2016-09-09 03:57:23 +03:00
Eric Snow
4f29e75289
Issue #24254 : Drop cls.__definition_order__.
2016-09-08 15:11:11 -07:00
Christian Heimes
07a2a1b7e5
Additional safe-guard against dereferencing NULL in reduce_newobj
...
_PyObject_GetNewArguments() can leave args == NULL but the __newobj_ex__
branch expects args to be not-NULL.
CID 1353201
2016-09-09 00:21:22 +02:00
Christian Heimes
884332b45a
Add NULL check for gen->gi_code in gen_send_ex()
...
_PyGen_Finalize() checks that gen->gi_code is not NULL before it
accesses the flags of the code object. This means that the flag
could be NULL.
It passes down the generatore to gen_close() and gen_send_ex().
gen_send_ex() did not check for gen->gi_code != NULL.
CID 1297900
2016-09-09 00:20:13 +02:00
Martin Panter
0be894b2f6
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-09-07 12:03:06 +00:00
Benjamin Peterson
b88db8745b
supress coroutine warning when an exception is pending ( #27968 )
2016-09-07 08:46:59 -07:00
Benjamin Peterson
33d2a492d0
promote some shifts to unsigned, so as not to invoke undefined behavior
2016-09-06 20:40:04 -07:00
Benjamin Peterson
5a7d923e75
make sure to not call memcpy with a NULL second argument
2016-09-06 17:58:25 -07:00
Benjamin Peterson
bdddb11b0e
clear out f_gen during generator finalization ( closes #27812 )
...
Patch from Armin Rigo.
2016-09-05 10:39:57 -07:00
Benjamin Peterson
2f40ed4b94
do not allow _PyGen_Finalize to fail ( closes #27811 )
...
Patch from Armin Rigo.
2016-09-05 10:14:54 -07:00
Benjamin Peterson
3c569295d6
do not worry about 64-bit dict sizes on 32-bit platforms
2016-09-08 13:16:41 -07:00
Victor Stinner
3b6a6b4215
Add a new private version to the builtin dict type
...
Issue #26058 : Add a new private version to the builtin dict type, incremented
at each dictionary creation and at each dictionary change.
Implementation of the PEP 509.
2016-09-08 12:51:24 -07:00
R David Murray
110b6fecbb
#27364 : Deprecate invalid escape strings in str/byutes.
...
Patch by Emanuel Barry, reviewed by Serhiy Storchaka and Martin Panter.
2016-09-08 15:34:08 -04:00
Benjamin Peterson
186122ead2
access dk_indices through a union
2016-09-08 12:20:12 -07:00
Victor Stinner
a4348cc1be
Add documentation to the dict implementation
...
Issue #27350 .
2016-09-08 12:01:25 -07:00
Victor Stinner
58f7c5a955
Reindeint DK_xxx macros
...
Issue #27350 .
2016-09-08 11:37:36 -07:00
Victor Stinner
208857ec33
dk_get_index/dk_set_index uses a type indices variable
...
Issue #27350 .
2016-09-08 11:35:46 -07:00
Benjamin Peterson
82cce4c5ef
use static inline instead of Py_LOCAL_INLINE
2016-09-08 11:56:06 -07:00
Victor Stinner
dee6e252cc
Split lookdict_unicode_nodummy() assertion to debug
...
Issue #27350 .
2016-09-08 11:16:07 -07:00
Benjamin Peterson
ee178e6d6e
fix spelling
2016-09-08 11:08:30 -07:00
Victor Stinner
71211e3386
Add assertions to dk_set_index()
...
Issue #27350 .
2016-09-08 10:52:46 -07:00
Steve Dower
cc16be85c0
Issue #27781 : Change file system encoding on Windows to UTF-8 (PEP 529)
2016-09-08 10:35:16 -07:00
Benjamin Peterson
003f059b3a
link to canonical blogspot
2016-09-08 10:14:31 -07:00
Benjamin Peterson
7322225a57
use native inline instead of Py_LOCAL_INLINE
2016-09-08 09:58:47 -07:00
Benjamin Peterson
f0acae2d3c
rearrange to make gcc happy
2016-09-08 09:50:08 -07:00
Victor Stinner
98ee9d5b73
Add Py_MEMBER_SIZE macro
...
Issue #27350 : use Py_MEMBER_SIZE() macro to get the size of
PyDictKeyEntry.dk_indices, rather than hardcoding 8.
2016-09-08 09:33:56 -07:00
Victor Stinner
742da040db
Implement compact dict
...
Issue #27350 : `dict` implementation is changed like PyPy. It is more compact
and preserves insertion order.
_PyDict_Dummy() function has been removed.
Disable test_gdb: python-gdb.py is not updated yet to the new structure of
compact dictionaries (issue #28023 ).
Patch written by INADA Naoki.
2016-09-07 17:40:12 -07:00
Benjamin Peterson
47ff0734b8
more PY_LONG_LONG to long long
2016-09-08 09:15:54 -07:00
Eric Snow
c943265ba5
Issue #15767 : Add ModuleNotFoundError.
2016-09-07 15:42:32 -07:00
Benjamin Peterson
2e7c5e9c11
replace some Py_LOCAL_INLINE with the inline keyword
2016-09-07 15:33:32 -07:00
Brett Cannon
d0600ed524
Make PyCodeObject.co_extra even more private to force users through the proper API.
2016-09-07 14:30:39 -07:00
Benjamin Peterson
d39206a78c
use c++ style comments
2016-09-07 14:12:36 -07:00
Brett Cannon
3788b85628
Change error return value to be more consistent with the rest of Python
2016-09-07 12:51:08 -07:00
Benjamin Peterson
1bf494b0ec
use a the bool type for a boolean variable
2016-09-07 11:28:35 -07:00
Brett Cannon
5c4de2863b
Add the co_extra field and accompanying APIs to code objects.
...
This completes PEP 523.
2016-09-07 11:16:41 -07:00
Benjamin Peterson
a9296e7f3b
require C99 bool
2016-09-07 11:06:17 -07:00
Benjamin Peterson
2f8bfef158
replace PY_SIZE_MAX with SIZE_MAX
2016-09-07 09:26:18 -07:00
Benjamin Peterson
9d2617bec0
merge 3.5 ( #27968 )
2016-09-07 08:47:18 -07:00
Benjamin Peterson
4b9abf3a27
merge 3.5
2016-09-06 20:42:17 -07:00
Brett Cannon
a571120410
Issue #27182 : Add support for path-like objects to PyUnicode_FSDecoder().
2016-09-06 19:36:01 -07:00
Benjamin Peterson
05448a62ae
merge 3.5
2016-09-06 17:58:44 -07:00
Victor Stinner
62ec3317d2
Optimize unicode_escape and raw_unicode_escape
...
Issue #16334 . Patch written by Serhiy Storchaka.
2016-09-06 17:04:34 -07:00
Victor Stinner
2740e46089
_PyUnicodeWriter: assert that max character <= MAX_UNICODE
2016-09-06 16:58:36 -07:00
Brett Cannon
ec6ce879c7
Issue #26027 : Support path-like objects in PyUnicode-FSConverter().
...
This is to add support for os.exec*() and os.spawn*() functions. Part
of PEP 519.
2016-09-06 15:50:29 -07:00
Benjamin Peterson
ca47063998
replace Py_(u)intptr_t with the c99 standard types
2016-09-06 13:47:26 -07:00
Benjamin Peterson
9b3d77052f
replace Python aliases for standard integer types with the standard integer types ( #17884 )
2016-09-06 13:24:00 -07:00
Serhiy Storchaka
ea525a2d1a
Issue #27078 : Added BUILD_STRING opcode. Optimized f-strings evaluation.
2016-09-06 22:07:53 +03:00
Benjamin Peterson
d953f8e10b
remove some silly defined() tests
2016-09-06 10:51:19 -07:00
Benjamin Peterson
af580dff4a
replace PY_LONG_LONG with long long
2016-09-06 10:46:49 -07:00
Victor Stinner
3466bde1cc
Avoid calling functions with an empty string as format string
...
Directly pass NULL rather than an empty string.
2016-09-05 18:16:01 -07:00
Victor Stinner
ad8c83ad6b
Avoid inefficient way to call functions without argument
...
Don't pass "()" format to PyObject_CallXXX() to call a function without
argument: pass NULL as the format string instead. It avoids to have to parse a
string to produce 0 argument.
2016-09-05 17:53:15 -07:00
Benjamin Peterson
ed4aa83ff7
require a long long data type ( closes #27961 )
2016-09-05 17:44:18 -07:00
Victor Stinner
942889aae2
Issue #27938 : Add a fast-path for us-ascii encoding
...
Other changes:
* Rewrite _Py_normalize_encoding() as a C implementation of
encodings.normalize_encoding(). For example, " utf-8 " is now normalized to
"utf_8". So the fast path is now used for more name variants of the same
encoding.
* Avoid strcpy() when encoding is NULL: call directly the UTF-8 codec
2016-09-05 15:40:10 -07:00
Eric Snow
92a6c170e6
Issue #24254 : Preserve class attribute definition order.
2016-09-05 14:50:11 -07:00
Benjamin Peterson
55f445282d
remove memory indirections in dict_traverse ( closes #27956 )
2016-09-05 12:12:59 -07:00
Victor Stinner
2250c4cb81
Issue #27830 : Remove unused _PyStack_AsDict()
...
I forgot to remove this function, I made a mistake in my revert.
2016-09-05 11:43:18 -07:00
Benjamin Peterson
7b24b27302
merge 3.5 ( #27812 )
2016-09-05 10:40:34 -07:00
Benjamin Peterson
98020812e6
merge 3.5 ( closes #27811 )
2016-09-05 10:16:31 -07:00
Mark Dickinson
7c4e409d07
Issue #11734 : Add support for IEEE 754 half-precision floats to the struct module. Original patch by Eli Stevens.
2016-09-03 17:21:29 +01:00
Victor Stinner
1a05d6c04d
PEP 7 style for if/else in C
...
Add also a newline for readability in normalize_encoding().
2016-09-02 12:12:23 +02:00
Raymond Hettinger
15f44ab043
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-08-30 10:47:49 -07:00
Mark Dickinson
82a95277b8
Issue #27870 : A left shift of zero by a large integer no longer attempts to allocate large amounts of memory.
2016-08-29 19:27:06 +01:00
Mark Dickinson
4e1de16f88
Issue #25402 : in int-to-decimal-string conversion, reduce intermediate storage requirements and relax restriction on converting large integers. Patch by Serhiy Storchaka.
2016-08-29 17:26:43 +01:00
Mark Dickinson
583c6e860c
Issue #27214 : Fix potential bug and remove useless optimization in long_invert. Thanks Oren Milman.
2016-08-29 16:40:29 +01:00
Martin Panter
1b6c6da85d
Issue #27506 : Support bytes/bytearray.translate() delete as keyword argument
...
Patch by Xiang Zhang.
2016-08-27 08:35:02 +00:00
Raymond Hettinger
f74c33ad5c
Merge
2016-08-25 21:12:16 -07:00
Raymond Hettinger
7ea386e56e
Issue 19504: Change "customise" to "customize" American spelling.
2016-08-25 21:11:50 -07:00
Victor Stinner
e90bdb19f2
Issue #27830 : Revert, remove _PyFunction_FastCallKeywords()
2016-08-25 23:26:50 +02:00
Victor Stinner
3f1057a4b6
method_call() and slot_tp_new() now uses fast call
...
Issue #27841 : Add _PyObject_Call_Prepend() helper function to prepend an
argument to existing arguments to call a function. This helper uses fast calls.
Modify method_call() and slot_tp_new() to use _PyObject_Call_Prepend().
2016-08-25 01:04:14 +02:00
Victor Stinner
f7507dd3e8
Issue #27830 : Fix _PyObject_FastCallKeywords()
...
Pass stack, not unrelated and uninitialized args!
2016-08-25 01:00:31 +02:00
Victor Stinner
53cb489ed0
_PyObject_FastCallDict(): avoid _Py_CheckFunctionResult()
...
_PyObject_FastCallDict() only requires _Py_CheckFunctionResult() for the
slow-path. Other cases already check for the result.
2016-08-25 00:39:34 +02:00
Victor Stinner
577e1f8cb4
Add _PyObject_FastCallKeywords()
...
Issue #27830 : Similar to _PyObject_FastCallDict(), but keyword arguments are
also passed in the same C array than positional arguments, rather than being
passed as a Python dict.
2016-08-25 00:29:32 +02:00
Victor Stinner
74319ae219
Use Py_ssize_t type for number of arguments
...
Issue #27848 : use Py_ssize_t rather than C int for the number of function
positional and keyword arguments.
2016-08-25 00:04:09 +02:00
Victor Stinner
dd69564c38
PyObject_CallMethodObjArgs() now uses fast call
...
Issue #27809 :
* PyObject_CallMethodObjArgs(), _PyObject_CallMethodIdObjArgs() and
PyObject_CallFunctionObjArgs() now use fast call to avoid the creation of a
temporary tuple
* Rename objargs_mktuple() to objargs_mkstack()
* objargs_mkstack() now stores objects in a C array using borrowed references,
instead of storing arguments into a tuple
objargs_mkstack() uses a small buffer allocated on the C stack for 5 arguments
or less, or allocates a buffer in the heap memory.
Note: this change is different than the change 0e4f26083bbb, I fixed the test
to decide if the small stack can be used or not. sizeof(PyObject**) was also
replaced with sizeof(stack[0]) since the sizeof() was wrong (but gave the same
result).
2016-08-24 01:14:54 +02:00
Victor Stinner
d48af09043
Backed out changeset 0e4f26083bbb (PyObject_CallMethodObjArgs)
2016-08-24 00:59:40 +02:00
Victor Stinner
e62b852605
PyObject_CallMethodObjArgs() now uses fast call
...
Issue #27809 :
* PyObject_CallMethodObjArgs(), _PyObject_CallMethodIdObjArgs() and
PyObject_CallFunctionObjArgs() now use fast call to avoid the creation of a
temporary tuple
* Rename objargs_mktuple() to objargs_mkstack()
* objargs_mkstack() now stores objects in a C array using borrowed references,
instead of storing arguments into a tuple
objargs_mkstack() uses a small buffer allocated on the C stack for 5 arguments
or less, or allocates a buffer in the heap memory.
2016-08-24 00:01:56 +02:00
Victor Stinner
463b86a881
Issue #27809 : Use _PyObject_FastCallDict()
...
Modify:
* init_subclass()
* builtin___build_class__()
Fix also a bug in init_subclass(): check for super() failure.
2016-08-22 23:33:13 +02:00
Victor Stinner
2990fa11bc
Issue #27809 : Use _PyObject_FastCallDict()
...
Modify:
* builtin_sorted()
* classmethoddescr_call()
* methoddescr_call()
* wrapperdescr_call()
2016-08-22 23:21:55 +02:00
Victor Stinner
b900939186
_PyFunction_FastCallDict() supports keyword args
...
Issue #27809 :
* Rename _PyFunction_FastCall() to _PyFunction_FastCallDict()
* Rename _PyCFunction_FastCall() to _PyCFunction_FastCallDict()
* _PyFunction_FastCallDict() now supports keyword arguments
2016-08-22 23:15:44 +02:00
Victor Stinner
559bb6a713
Rename _PyObject_FastCall() to _PyObject_FastCallDict()
...
Issue #27809 :
* Rename _PyObject_FastCall() function to _PyObject_FastCallDict()
* Add _PyObject_FastCall(), _PyObject_CallNoArg() and _PyObject_CallArg1()
macros calling _PyObject_FastCallDict()
2016-08-22 22:48:54 +02:00
Mark Dickinson
b820d7f631
Issue #27792 : force int return type for modulo operations involving bools.
2016-08-22 12:24:46 +01:00
Serhiy Storchaka
54cd1969ea
Issue #26984 : int() now always returns an instance of exact int.
2016-08-21 20:03:08 +03:00
Mark Dickinson
1dc3c898a8
Untabify Objects/longobject.c.
2016-08-21 10:33:36 +01:00
Mark Dickinson
dc590a4cc3
Issue #25604 : Fix minor bug in integer true division, which could
...
have caused off-by-one-ulp results on certain platforms.
2016-08-21 10:23:23 +01:00
Mark Dickinson
5d13238f6e
Issue #27662 : don't use PY_SIZE_MAX for overflow checking in List_New. Patch by Xiang Zhang.
2016-08-21 08:55:15 +01:00
Nick Coghlan
cbcd221de4
Merge #27782 fix from 3.5
2016-08-21 17:43:58 +10:00
Nick Coghlan
8682f578c1
Issue #27782 : Fix m_methods handling in multiphase init
...
Multi-phase extension module import now correctly allows the
``m_methods`` field to be used to add module level functions
to instances of non-module types returned from ``Py_create_mod``.
Patch by Xiang Zhang.
2016-08-21 17:41:56 +10:00
Serhiy Storchaka
3766572a48
Issue #27692 : Removed unnecessary NULL checks in exceptions.c.
...
Patch by Xiang Zhang.
2016-08-20 21:22:03 +03:00
Victor Stinner
253021dd94
Issue #27366 : Fix init_subclass()
...
Handle PyTuple_New(0) failure.
2016-08-20 02:37:41 +02:00
Victor Stinner
9def0901e2
PyFile_WriteObject() now uses fast call
...
Issue #27128 : PyFile_WriteObject() now calls _PyObject_FastCall() to avoid the
creation of a temporary tuple.
2016-08-20 00:44:04 +02:00
Victor Stinner
99ee9c70a7
calliter_iternext() now uses fast call
...
Issue #27128 : calliter_iternext() now calls _PyObject_FastCall() to avoid a
temporary empty tuple.
Cleanup also the code to reduce the indentation level.
2016-08-19 18:47:10 +02:00
Victor Stinner
6911267615
slot_tp_iter() now uses fast call
...
Issue #27128 : slot_tp_iter() now calls _PyObject_FastCall() to avoid a
temporary empty tuple.
2016-08-19 18:41:02 +02:00
Victor Stinner
20a3007a8d
slot_nb_bool() now uses fast call
...
Issue #27128 : slot_nb_bool() now calls _PyObject_FastCall() to avoid a
temporary empty tuple to call the slot function.
2016-08-19 18:28:25 +02:00
Victor Stinner
a12eec48b6
Issue #27128 : Cleanup slot_nb_bool()
...
Use an error label to reduce the level of indentation.
2016-08-19 18:26:05 +02:00
Victor Stinner
5e87749a8e
Issue #27128 : slot_sq_item() uses fast call
...
slot_sq_item() now calls _PyObject_FastCall() to avoid the creation of a
temporary tuple of 1 item to pass the 'item' argument to the slot function.
2016-08-19 18:19:42 +02:00
Victor Stinner
018016d8e3
Issue #27128 : Cleanup slot_sq_item()
...
* Invert condition of test to avoid levels of indentation
* Remove useless Py_XDECREF(args) in the error block
* Replace Py_XDECREF(func) with Py_DECREF(func) in the error block: func cannot
be NULL when reaching the error block
2016-08-19 18:17:37 +02:00
Victor Stinner
f736c261a2
call_method() and call_maybe() now use fast call
...
Issue #27128 . The call_method() and call_maybe() functions of typeobject.c now
use fast call for empty format string to avoid the creation of a temporary
empty tuple.
2016-08-19 18:05:37 +02:00
Victor Stinner
94463c980e
Cleanup call_method() and call_maybe()
...
Issue #27128 . Move va_start/va_end around Py_VaBuildValue().
2016-08-19 18:01:41 +02:00