summaryrefslogtreecommitdiff
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
...
* Document why functools.partial() must copy kwargs (#253)Victor Stinner2017-02-231-2/+2
| | | | Add a comment to prevent further attempts to avoid a copy for optimization.
* bpo-27660: remove unnecessary overflow checks in list_resize (GH-189)Xiang Zhang2017-02-221-12/+7
|
* bpo-29509: skip redundant intern (GH-197)INADA Naoki2017-02-211-1/+1
| | | | PyObject_GetAttrString intern temporary key string. It's completely redudant.
* bpo-29602: fix signed zero handling in complex constructor. (#203)Mark Dickinson2017-02-201-3/+3
| | | | | | * Fix incorrect handling of signed zeros for complex-related classes. * Add Misc/NEWS entry.
* bpo-24274: fix erroneous comment in dictobject.c (GH-196)INADA Naoki2017-02-201-1/+2
| | | | lookdict_unicode() and lookdict_unicode_nodummy() may raise exception when key is not unicode.
* bpo-29347: Fix possibly dereferencing undefined pointers when creating ↵Xiang Zhang2017-02-201-0/+2
| | | | weakref objects (#128)
* bpo-29548: Fix some inefficient call API usage (GH-97)INADA Naoki2017-02-164-30/+17
|
* bpo-29524: Add Objects/call.c file (#12)Victor Stinner2017-02-123-1048/+1368
| | | | | | | | | * 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.
* bpo-29438: fixed use-after-free in key sharing dict (#17)INADA Naoki2017-02-121-3/+7
|
* Backed out changeset f23fa1f7b68fVictor Stinner2017-02-103-1368/+1048
| | | | | Sorry, I didn't want to push this change before the review :-( I was pushing a change into the 2.7 branch.
* Issue #29465: Add Objects/call.c fileVictor Stinner2017-02-103-1048/+1368
| | | | | | | | | | * 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.
* 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-251-24/+54
|\ | | | | | | | | | | 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().
| * Issue #27867: Function PySlice_GetIndicesEx() is replaced with a macro ifSerhiy Storchaka2017-01-251-24/+54
| |\ | | | | | | | | | | | | Py_LIMITED_API is not set or set to the value between 0x03050400 and 0x03060000 (not including) or 0x03060100 or higher.
| | * Issue #27867: Function PySlice_GetIndicesEx() is replaced with a macro ifSerhiy Storchaka2017-01-251-24/+54
| | | | | | | | | | | | | | | Py_LIMITED_API is not set or set to the value between 0x03050400 and 0x03060000 (not including) or 0x03060100 or higher.
* | | 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-241-3/+3
|\ \ \ | |/ / | | | | | | Warnings could be emitted at compile time.
| * | Issue #29337: Fixed possible BytesWarning when compare the code objects.Serhiy Storchaka2017-01-241-3/+3
| |\ \ | | |/ | | | | | | Warnings could be emitted at compile time.
| | * Issue #29337: Fixed possible BytesWarning when compare the code objects.Serhiy Storchaka2017-01-241-3/+3
| | | | | | | | | | | | 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.