summaryrefslogtreecommitdiff
path: root/Objects/abstract.c
Commit message (Collapse)AuthorAgeFilesLines
...
* _PyObject_FastCallKeywords() now checks !PyErr_Occurred()Victor Stinner2017-01-181-0/+5
| | | | | Issue #29259. All other functions calling functions start with the similar assertion.
* _PyObject_FastCallKeywords() now checks the resultVictor Stinner2017-01-181-0/+2
| | | | Issue ##27830, Issue #29259.
* Remove unused func parameter of _PyStack_UnpackDict()Victor Stinner2017-01-181-1/+1
| | | | Issue #29259.
* _PyStack_UnpackDict() now returns -1 on errorVictor Stinner2017-01-171-7/+9
| | | | | 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-171-1/+1
| | | | Issue #29286.
* Add _PyStack_AsTupleSlice() helperVictor Stinner2017-01-161-0/+23
|
* Disable _PyStack_AsTuple() inliningVictor Stinner2017-01-111-1/+3
| | | | | | | | | | | | | | | 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)
* call_method() now uses _PyObject_FastCall()Victor Stinner2017-01-111-5/+5
| | | | | | | | | | | | | | | | | | | 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.
* Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of ↵Serhiy Storchaka2016-12-161-2/+1
| | | | dict.
* Use _PyDict_NewPresized() in _PyStack_AsDict()Victor Stinner2016-12-151-1/+1
| | | | Issue #27810.
* Add _PY_FASTCALL_SMALL_STACK constantVictor Stinner2016-12-151-3/+3
| | | | | | | | | 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.
* Fix _PyObject_CallFunctionVa(), use the small stackVictor Stinner2016-12-151-2/+1
| | | | | Issue #28915. Oops, I disabled the small stack to test both code paths. It's now fixed.
* Issue #28820: Merge typo fixes from 3.6Martin Panter2016-12-101-1/+1
|\
| * Fix typos in comment and documentationMartin Panter2016-12-101-1/+1
| |
* | Remove useless variable initializationVictor Stinner2016-12-091-9/+6
| | | | | | | | Don't initialize variables which are not used before they are assigned.
* | Use PyObject_CallFunctionObjArgs()Victor Stinner2016-12-091-1/+1
| | | | | | | | | | | | | | | | | | 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.
* | Add _PyObject_VaCallFunctionObjArgs() private functionVictor Stinner2016-12-091-5/+5
| | | | | | | | | | Issue #28915: Similar to _PyObject_CallFunctionObjArgs() but use va_list to pass arguments.
* | _PyObject_CallFunctionVa() uses fast callVictor Stinner2016-12-091-9/+25
| | | | | | | | | | | | | | | | 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.
* | Add _PyObject_CallFunctionVa() helperVictor Stinner2016-12-091-54/+29
| | | | | | | | | | | | | | | | | | Issue #28915: Add _PyObject_CallFunctionVa() helper to factorize code of functions: * PyObject_CallFunction() * _PyObject_CallFunction_SizeT() * callmethod()
* | Add _PyObject_FastCallVa() helperVictor Stinner2016-12-091-71/+37
| | | | | | | | | | | | | | | | | | | | | | 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().
* | _PyObject_FastCallKeywords() now calls directly tp_callVictor Stinner2016-12-071-15/+45
| | | | | | | | | | _PyObject_FastCallKeywords() doesn't call _PyObject_FastCallDict() anymore: call directly tp_call.
* | Fix typo in a comment of abstract.cVictor Stinner2016-12-061-1/+1
| |
* | Use _PyObject_CallNoArg()Victor Stinner2016-12-061-1/+1
| | | | | | | | | | | | | | Replace: PyObject_CallFunctionObjArgs(callable, NULL) with: _PyObject_CallNoArg(callable)
* | Uniformize argument names of "call" functionsVictor Stinner2016-12-061-70/+78
| | | | | | | | | | | | | | | | | | | | | | | | 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)
* | Issue #28858: Remove _PyObject_CallArg1() macroVictor Stinner2016-12-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Backed out changeset b9c9691c72c5Victor Stinner2016-12-041-4/+4
| | | | | | | | | | | | Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like _PyObject_CallArg1() uses more stack memory than PyObject_CallFunctionObjArgs().
* | Replace PyObject_CallFunctionObjArgs() with fastcallVictor Stinner2016-12-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Backed out changeset 7efddbf1aa70Victor Stinner2016-11-301-62/+60
| |
* | Uniformize argument names of "call" functionsVictor Stinner2016-11-291-60/+62
| | | | | | | | | | | | | | | | | | | | | | | | * 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
* | Issue #19569: Compiler warnings are now emitted if use most of deprecatedSerhiy Storchaka2016-11-201-11/+17
|/ | | | functions.
* Issue #28410: Added _PyErr_FormatFromCause() -- the helper for raisingSerhiy Storchaka2016-10-211-12/+10
| | | | | | | | 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]
* remove unneeded castBenjamin Peterson2016-09-221-1/+1
|
* va_end() all va_copy()ed va_lists.Christian Heimes2016-09-211-0/+2
|
* replace usage of Py_VA_COPY with the (C99) standard va_copyBenjamin Peterson2016-09-201-1/+1
|
* Issue #28126: Replace Py_MEMCPY with memcpy(). Visual Studio can properly ↵Christian Heimes2016-09-131-2/+2
| | | | optimize memcpy().
* Document kwnames in _PyObject_FastCallKeywords() and _PyStack_AsDict()Victor Stinner2016-09-121-0/+3
| | | | Issue #27213.
* Revert change f860b7a775c5Victor Stinner2016-09-121-19/+7
| | | | | Revert change "Issue #27213: Reintroduce checks in _PyStack_AsDict()", pushed by mistake.
* ssue #27213: Reintroduce checks in _PyStack_AsDict()Victor Stinner2016-09-121-7/+19
|
* Issue #27213: Fixed different issues with reworked CALL_FUNCTION* opcodes.Serhiy Storchaka2016-09-121-19/+7
| | | | | | | | | | | * 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.
* Add METH_FASTCALL calling conventionVictor Stinner2016-09-091-0/+56
| | | | | | | | | | | 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.
* Issue #27810: Add _PyCFunction_FastCallKeywords()Victor Stinner2016-09-091-2/+5
| | | | | 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.
* Add _PyObject_FastCallKeywords()Victor Stinner2016-09-091-0/+68
| | | | | | | | | | 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()
* Issue #27078: Added BUILD_STRING opcode. Optimized f-strings evaluation.Serhiy Storchaka2016-09-061-1/+19
|
* Issue #27830: Remove unused _PyStack_AsDict()Victor Stinner2016-09-051-34/+0
| | | | I forgot to remove this function, I made a mistake in my revert.
* Issue #27830: Revert, remove _PyFunction_FastCallKeywords()Victor Stinner2016-08-251-45/+0
|
* method_call() and slot_tp_new() now uses fast callVictor Stinner2016-08-251-0/+39
| | | | | | | 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().
* Issue #27830: Fix _PyObject_FastCallKeywords()Victor Stinner2016-08-251-1/+1
| | | | Pass stack, not unrelated and uninitialized args!
* _PyObject_FastCallDict(): avoid _Py_CheckFunctionResult()Victor Stinner2016-08-251-2/+2
| | | | | _PyObject_FastCallDict() only requires _Py_CheckFunctionResult() for the slow-path. Other cases already check for the result.
* Add _PyObject_FastCallKeywords()Victor Stinner2016-08-251-0/+79
| | | | | | 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.
* Use Py_ssize_t type for number of argumentsVictor Stinner2016-08-251-1/+1
| | | | | Issue #27848: use Py_ssize_t rather than C int for the number of function positional and keyword arguments.