summaryrefslogtreecommitdiff
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Issue #29507: Fix _PyObject_CallFunctionVa()Victor Stinner2017-02-101-2/+4
| | | | is_size_t test was reversed. Bug spotted by INADA Naoki.
* Optimize slots: avoid temporary PyMethodObjectVictor Stinner2017-02-092-58/+160
| | | | | | | | | | | | | | | | | | 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>
* Fix PyCFunction_Call() performance issueVictor Stinner2017-02-091-4/+50
| | | | | | | 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.
* Fix refleaks if Py_EnterRecursiveCall() failsVictor Stinner2017-02-081-1/+4
| | | | Issue #29306: Destroy argstuple and kwdict if Py_EnterRecursiveCall() fails.
* Issue #29306: Fix usage of Py_EnterRecursiveCall()Victor Stinner2017-02-082-73/+90
| | | | | | | * *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
* Issue #29460: _PyArg_NoKeywords(), _PyArg_NoStackKeywords() andSerhiy Storchaka2017-02-061-3/+2
| | | | _PyArg_NoPositional() now are macros.
* Reduce load factor (from 66% to 60%) to improve effectiveness of linear probing.Raymond Hettinger2017-02-041-3/+3
| | | | | | | 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).
* Issue #29311: Regenerate Argument Clinic.Serhiy Storchaka2017-02-042-3/+3
|
* Issue #29263: LOAD_METHOD support for C methodsINADA Naoki2017-02-033-25/+70
| | | | Calling builtin method is at most 10% faster.
* Remove unnecessary variables.Raymond Hettinger2017-02-021-5/+2
| | | | | * so->used never gets changed during a resize * so->filled only changes when dummies are present and being eliminated
* Issue #29421: Make int.to_bytes() and int.from_bytes() slightly fasterSerhiy Storchaka2017-02-021-4/+7
| | | | (10-20% for small integers).
* Issue #20185: Converted the int class to Argument Clinic.Serhiy Storchaka2017-02-012-135/+303
| | | | Based on patch by Vajrasky Kok.
* Issue #29383: reduce temporary interned unicodeINADA Naoki2017-01-281-3/+10
| | | | | | | | | | | | | | 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
* Issue #29358: Add postcondition checks on typesVictor Stinner2017-01-251-3/+24
|
* Issue #27867: Function PySlice_GetIndicesEx() is deprecated and replaced withSerhiy Storchaka2017-01-2536-1821/+3143
|\ | | | | | | | | | | 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().
| * Issues #29311, #29289: Fixed and improved docstrings for dict and OrderedDictSerhiy Storchaka2017-01-254-34/+36
| | | | | | | | methods.
| * Issue #29337: Fixed possible BytesWarning when compare the code objects.Serhiy Storchaka2017-01-2436-1815/+3135
| |\ | | | | | | | | | Warnings could be emitted at compile time.
| | * Issue #29360: _PyStack_AsDict() doesn't check kwnamesVictor Stinner2017-01-241-2/+1
| | | | | | | | | | | | | | | Remove two assertions which can fail on legit code. Keyword arguments are checked later with better tests and raise a regular (TypeError) exception.
| | * Fix grammar in doc string, RST markupMartin Panter2017-01-242-4/+4
| | |
| | * Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE whereverSerhiy Storchaka2017-01-231-4/+2
| | | | | | | | | | | | possible but Coccinelle couldn't find opportunity.
| | * Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE whereverSerhiy Storchaka2017-01-239-51/+25
| | | | | | | | | | | | possible. Patch is writen with Coccinelle.
| | * Issue #28769: The result of PyUnicode_AsUTF8AndSize() and PyUnicode_AsUTF8()Serhiy Storchaka2017-01-222-6/+6
| | | | | | | | | | | | is now of type "const char *" rather of "char *".
| | * Issue #29331: Simplified argument parsing in sorted() and list.sort().Serhiy Storchaka2017-01-211-15/+15
| | |
| | * Issue #29289: Argument Clinic generates reasonable name for the parameter ↵Serhiy Storchaka2017-01-192-14/+14
| | | | | | | | | | | | "default".
| | * Issue #29311: Argument Clinic generates reasonable name for the parameter ↵Serhiy Storchaka2017-01-192-17/+19
| | | | | | | | | | | | "default".
| | * Issue #20186: Converted builtins enumerate() and reversed() to Argument Clinic.Serhiy Storchaka2017-01-192-39/+121
| | | | | | | | | | | | Patch by Tal Einat.
| | * Add a note explaining why dict_update() doesn't use METH_FASTCALLVictor Stinner2017-01-191-0/+3
| | | | | | | | | | | | Issue #29312.
| | * dict.get() and dict.setdefault() now use ACVictor Stinner2017-01-192-25/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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, /)
| | * _PyStack_AsDict() now checks kwnames != NULLVictor Stinner2017-01-181-1/+3
| | | | | | | | | | | | Issue #29259.
| | * Cleanup _PyMethodDef_RawFastCallDict()Victor Stinner2017-01-181-11/+9
| | | | | | | | | | | | | | | | | | 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.
| | * Rephrase !PyErr_Occurred() comment: may=>canVictor Stinner2017-01-184-6/+6
| | | | | | | | | | | | Issue #29259.
| | * _PyObject_FastCallKeywords() now checks !PyErr_Occurred()Victor Stinner2017-01-181-0/+5
| | | | | | | | | | | | | | | Issue #29259. All other functions calling functions start with the similar assertion.
| | * PyCFunction_Call() now calls _PyCFunction_FastCallDict()Victor Stinner2017-01-181-70/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * Fix _PyMethodDef_RawFastCallDict() argument parsingVictor Stinner2017-01-181-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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()
| | * _PyObject_FastCallKeywords() now checks the resultVictor Stinner2017-01-181-0/+2
| | | | | | | | | | | | Issue ##27830, Issue #29259.
| | * Optimize methoddescr_call(): avoid temporary PyCFunctionVictor Stinner2017-01-182-26/+33
| | | | | | | | | | | | | | | | | | 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.
| | * Remove unused func parameter of _PyStack_UnpackDict()Victor Stinner2017-01-182-3/+2
| | | | | | | | | | | | Issue #29259.
| | * Convert some OrderedDict methods to Argument ClinicVictor Stinner2017-01-172-87/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #29289. Convert methods: * fromkeys() class method * setdefault() * popitem() * move_to_end()
| | * Run Argument Clinic: METH_VARARGS=>METH_FASTCALLVictor Stinner2017-01-175-37/+77
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * Run Argument Clinic: METH_VARARGS=>METH_FASTCALLVictor Stinner2017-01-173-39/+87
| | | | | | | | | | | | | | | Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling convention for functions using only positional arguments.
| | * _PyStack_UnpackDict() now returns -1 on errorVictor Stinner2017-01-172-9/+11
| | | | | | | | | | | | | | | Issue #29286. Change _PyStack_UnpackDict() prototype to be able to notify of failure when args is NULL.
| | * Rename _PyArg_ParseStack to _PyArg_ParseStackAndKeywordsVictor Stinner2017-01-174-16/+16
| | | | | | | | | | | | Issue #29286.
| | * type_prepare() now uses fast call (METH_FASTCALL)Victor Stinner2017-01-161-2/+3
| | |
| | * Add _PyStack_AsTupleSlice() helperVictor Stinner2017-01-161-0/+23
| | |
| | * Optimize _PyCFunction_FastCallKeywords()Victor Stinner2017-01-161-36/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * Issue #20180: forgot to update AC output.INADA Naoki2017-01-162-41/+39
| | |
| | * Issue #20180: convert unicode methods to AC.INADA Naoki2017-01-162-409/+1405
| | |
| | * Merge doc fixes from 3.6Martin Panter2017-01-141-1/+1
| | |\
| | * | Issue #1621: Overflow should not be possible in listextend()Martin Panter2017-01-141-0/+3
| | | |
| | * | Issue #28969: Fixed race condition in C implementation of functools.lru_cache.Serhiy Storchaka2017-01-121-8/+23
| | |\ \ | | | | | | | | | | | | | | | | | | | | KeyError could be raised when cached function with full cache was simultaneously called from differen threads with the same uncached arguments.