Commit Graph

901 Commits

Author SHA1 Message Date
Nathaniel J. Smith ab4413a7e9 bpo-30039: Don't run signal handlers while resuming a yield from stack (#1081)
If we have a chain of generators/coroutines that are 'yield from'ing
each other, then resuming the stack works like:

- call send() on the outermost generator
- this enters _PyEval_EvalFrameDefault, which re-executes the
  YIELD_FROM opcode
- which calls send() on the next generator
- which enters _PyEval_EvalFrameDefault, which re-executes the
  YIELD_FROM opcode
- ...etc.

However, every time we enter _PyEval_EvalFrameDefault, the first thing
we do is to check for pending signals, and if there are any then we
run the signal handler. And if it raises an exception, then we
immediately propagate that exception *instead* of starting to execute
bytecode. This means that e.g. a SIGINT at the wrong moment can "break
the chain" – it can be raised in the middle of our yield from chain,
with the bottom part of the stack abandoned for the garbage collector.

The fix is pretty simple: there's already a special case in
_PyEval_EvalFrameEx where it skips running signal handlers if the next
opcode is SETUP_FINALLY. (I don't see how this accomplishes anything
useful, but that's another story.) If we extend this check to also
skip running signal handlers when the next opcode is YIELD_FROM, then
that closes the hole – now the exception can only be raised at the
innermost stack frame.

This shouldn't have any performance implications, because the opcode
check happens inside the "slow path" after we've already determined
that there's a pending signal or something similar for us to process;
the vast majority of the time this isn't true and the new check
doesn't run at all.
2017-05-17 13:33:23 -07:00
Xiang Zhang 2ddf5a19c3 bpo-30281: Fix the default value for stop in PySlice_Unpack() (#1480) 2017-05-10 18:19:41 +08:00
Serhiy Storchaka d4edfc9abf bpo-29935: Fixed error messages in the index() method of tuple, list and deque (#887)
when pass indices of wrong type.
2017-03-30 18:29:23 +03:00
Serhiy Storchaka aefa7ebf0f bpo-6532: Make the thread id an unsigned integer. (#781)
* bpo-6532: Make the thread id an unsigned integer.

From C API side the type of results of PyThread_start_new_thread() and
PyThread_get_thread_ident(), the id parameter of
PyThreadState_SetAsyncExc(), and the thread_id field of PyThreadState
changed from "long" to "unsigned long".

* Restore a check in thread_get_ident().
2017-03-23 14:48:39 +01:00
Xiang Zhang 4830f581af bpo-29849: fix a memory leak in import_from (GH-712) 2017-03-21 11:13:42 +08:00
Serhiy Storchaka 80ec8364f1 bpo-29748: Added the slice index converter in Argument Clinic. (#549) 2017-03-19 19:37:40 +02:00
INADA Naoki 93fac8dd35 bpo-29676: fix lsprof can't profile C method call. (GH523)
When LOAD_METHOD is used for calling C mehtod, PyMethodDescrObject
was passed to profilefunc from 5566bbb.
But lsprof traces only PyCFunctionObject. Additionally, there can be
some third party extension which assumes passed arg is
PyCFunctionObject without calling PyCFunction_Check().

So make PyCFunctionObject from PyMethodDescrObject when
tstate->c_profilefunc is set.
2017-03-07 14:24:37 +09:00
Yury Selivanov 398ff91ac0 bpo-28893: Set __cause__ for errors in async iteration protocol (#407) 2017-03-02 22:20:00 -05:00
Matthias Bussonnier 160edb4357 bpo-29655: Fixed possible reference leaks in `import *`. (#301)
Patch by Matthias Bussonnier.
2017-02-26 07:58:05 +02:00
Martijn Pieters d7e64337ef bpo-28598: Support __rmod__ for RHS subclasses of str in % string formatting operations (#51)
When you use `'%s' % SubClassOfStr()`, where `SubClassOfStr.__rmod__` exists, the reverse operation is ignored as normally such string formatting operations use the `PyUnicode_Format()` fast path. This patch tests for subclasses of `str` first and picks the slow path in that case.

Patch by Martijn Pieters.
2017-02-23 15:38:04 +02:00
Matthias Bussonnier 1bc156430b bpo-29546: Improve from-import error message with location (#103)
bpo-29546: Improve from-import error message with location
2017-02-22 10:06:50 -05:00
Matthias Bussonnier bc4bed4405 bpo-29546: Set 'path' on ImportError for ``from ... import ...`` (GH-91) 2017-02-14 16:05:25 -08: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
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
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
Victor Stinner 122fb562d4 Document that _PyFunction_FastCallDict() must copy kwargs
Issue #29318: Caller and callee functions must not share the dictionary:
kwargs must be copied.
2017-02-01 17:04:52 +01:00
Victor Stinner a8cb515a29 Rephrase !PyErr_Occurred() comment: may=>can
Issue #29259.
2017-01-18 14:12:51 +01:00
INADA Naoki 015bce64b3 Issue #26110: Add document for LOAD_METHOD and CALL_METHOD opcode.
Changed stack layout bit for "easy to explain."
2017-01-16 17:23:30 +09:00
Victor Stinner 231d1f3439 _PyEval_EvalCodeWithName(): remove redundant check
Replace the runtime check with an assertion (just in case).
2017-01-11 02:12:06 +01:00
Victor Stinner 415c5107be Inline call_function()
Issue #29227: Inline call_function() into _PyEval_EvalFrameDefault() using
Py_LOCAL_INLINE to reduce the stack consumption.

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

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

=> total: 3392 => 3136 (- 256 B)
2017-01-11 00:54:57 +01:00
Victor Stinner 865a0f621f Optimize _PyFunction_FastCallDict() when kwargs is {}
Issue #28839: Optimize _PyFunction_FastCallDict() when kwargs is an empty
dictionary, avoid the creation of an useless empty tuple.
2017-01-03 02:01:42 +01:00
INADA Naoki 9c15776fac Issue #29049: Remove unnecessary Py_DECREF 2016-12-26 18:52:46 +09:00
INADA Naoki 6a3cedf8dd Issue #29049: Fix refleak introduced by f5eb0c4f5d37. 2016-12-26 18:01:46 +09: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
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
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
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 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
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
Victor Stinner 842cfff321 WITH_CLEANUP_START uses fastcall
Modify WITH_CLEANUP_START bytecode: replace PyObject_CallFunctionObjArgs() with
_PyObject_FastCall().
2016-12-01 14:45:31 +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 b69ee8c386 call_function(): document PyMethod optimization 2016-11-28 18:32:31 +01:00
Victor Stinner 048afd98b3 Remove CALL_PROFILE special build
Issue #28799:

* Remove the PyEval_GetCallStats() function.
* Deprecate the untested and undocumented sys.callstats() function.
* Remove the CALL_PROFILE special build

Use the sys.setprofile() function, cProfile or profile module to profile
function calls.
2016-11-28 11:59:04 +01: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
Raymond Hettinger 3fa28fd075 merge 2016-11-22 11:50:56 -08:00
Raymond Hettinger 64e2f9ac86 Issue #27100: Fix ref leak 2016-11-22 11:50:40 -08:00
Raymond Hettinger 9af740b99a merge 2016-11-21 17:24:58 -08:00
Raymond Hettinger a3fec1543d Issue #27100: With statement reports missing __enter__ before __exit__. (Contributed by Jonathan Ellington.) 2016-11-21 17:24:23 -08: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
Raymond Hettinger c32f9db846 Issue #28665: Use macro form of PyCell_GET/SET 2016-11-12 04:10:35 -05:00
Raymond Hettinger b2b154374d merge 2016-11-11 04:32:11 -08:00
Raymond Hettinger 13527123a1 Issue #28665: Harmonize STORE_DEREF with STORE_FAST and LOAD_DEREF giving a 40% speedup. 2016-11-11 04:31:18 -08: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
Serhiy Storchaka 818b5cc6db Fixed possible abort in ceval loop if _PyUnicode_FromId() fails.
Every opcode should end with DISPATCH() or goto error.
2016-11-08 23:14:00 +02:00
Serhiy Storchaka 4678b2f448 Fixed possible abort in ceval loop if _PyUnicode_FromId() fails.
Every opcode should end with DISPATCH() or goto error.
2016-11-08 23:13:36 +02:00
Serhiy Storchaka 70b72f0f96 Fixed possible abort in ceval loop if _PyUnicode_FromId() fails.
Every opcode should end with DISPATCH() or goto error.
2016-11-08 23:12:46 +02:00
Yury Selivanov 0ee446c894 Merge 3.6 (issue #27243) 2016-11-08 15:15:42 -05:00
Yury Selivanov 2edd8a1e2c Issue #27243: Change PendingDeprecationWarning -> DeprecationWarning.
As it was agreed in the issue, __aiter__ returning an awaitable
should result in PendingDeprecationWarning in 3.5 and in
DeprecationWarning in 3.6.
2016-11-08 15:13:07 -05:00
Victor Stinner d65f42a132 Issue #21955: Please don't try to optimize int+int 2016-10-20 12:18:10 +02:00
Raymond Hettinger 4186222e63 Minor fix-up to apply the stack adjustment macros consistent with the other opcodes 2016-10-15 19:03:06 -07:00
Serhiy Storchaka 5665301bae Issue #28257: Improved error message when pass a non-mapping as a var-keyword
argument.
2016-10-07 23:32:41 +03:00
Berker Peksag 419968c235 Issue #27358: Merge from 3.6 2016-10-02 13:08:47 +03:00
Berker Peksag 8e9045d0d8 Issue #27358: Fix typo in error message 2016-10-02 13:08:25 +03: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 775a0ea0da Issue #28257: Improved error message when pass a non-iterable as
a var-positional argument.  Added opcode BUILD_TUPLE_UNPACK_WITH_CALL.
2016-10-02 10:34:46 +03:00
Serhiy Storchaka 7344285c19 Issue #28257: Improved error message when pass a non-iterable as
a var-positional argument.  Added opcode BUILD_TUPLE_UNPACK_WITH_CALL.
2016-10-02 10:33:46 +03:00
Serhiy Storchaka c019158a4c Issue #27703: Got rid of unnecessary NULL checks in do_raise() in release mode.
Patch by Xiang Zhang.
2016-09-27 11:37:10 +03:00
Serhiy Storchaka 208bbd29d3 Silence GCC warning.
The code was correct, but GCC is not enough clever.
2016-09-22 19:59:46 +03:00
Serhiy Storchaka 63dc548109 Issue #28086: Single var-positional argument of tuple subtype was passed
unscathed to the C-defined function.  Now it is converted to exact tuple.
2016-09-22 19:41:20 +03:00
Victor Stinner 57f91ac95a Document kwnames in _PyObject_FastCallKeywords() and _PyStack_AsDict()
Issue #27213.
2016-09-12 13:37:07 +02:00
Victor Stinner eece2229e2 Issue #27213: Fix reference leaks 2016-09-12 11:16:37 +02: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
Łukasz Langa a785c87d6e DTrace support: function calls, GC activity, line execution
Tested on macOS 10.11 dtrace, Ubuntu 16.04 SystemTap, and libbcc.

Largely based by an initial patch by Jesús Cea Avión, with some
influence from Dave Malcolm's SystemTap patch and Nikhil Benesch's
unification patch.

Things deliberately left out for simplicity:
- ustack helpers, I have no way of testing them at this point since
they are Solaris-specific
- PyFrameObject * in function__entry/function__return, this is
SystemTap-specific
- SPARC support
- dynamic tracing
- sys module dtrace facility introspection

All of those might be added later.
2016-09-09 17:37:37 -07:00
Benjamin Peterson 75f94a7dff remove more READ_TIMESTAMP 2016-09-09 15:03:18 -07:00
Benjamin Peterson 1cfe1d1f53 remove READ_TIMESTAMP macro 2016-09-09 15:02:11 -07:00
Benjamin Peterson 4fd64b9a6a remove ceval timestamp support 2016-09-09 14:57:58 -07: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
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
Victor Stinner f9b760f48a Rework CALL_FUNCTION* opcodes
Issue #27213: Rework CALL_FUNCTION* opcodes to produce shorter and more
efficient bytecode:

* CALL_FUNCTION now only accepts position arguments
* CALL_FUNCTION_KW accepts position arguments and keyword arguments, but keys
  of keyword arguments are packed into a constant tuple.
* CALL_FUNCTION_EX is the most generic, it expects a tuple and a dict for
  positional and keyword arguments.

CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW opcodes have been removed.

2 tests of test_traceback are currently broken: skip test, the issue #28050 was
created to track the issue.

Patch by Demur Rumed, design by Serhiy Storchaka, reviewed by Serhiy Storchaka
and Victor Stinner.
2016-09-09 10:17:08 -07:00
Yury Selivanov 50c584f50b ceval: tighten the code of STORE_ANNOTATION 2016-09-08 23:38:21 -07:00
Yury Selivanov eb6364557f Issue #28003: Implement PEP 525 -- Asynchronous Generators. 2016-09-08 22:01:51 -07:00
Yury Selivanov f8cb8a16a3 Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations.
Patch by Ivan Levkivskyi.
2016-09-08 20:50:03 -07:00
Raymond Hettinger 4c483ad52b Merge 2016-09-08 14:45:40 -07:00
Raymond Hettinger 262b6793e0 Issue #26020: Fix evaluation order for set literals 2016-09-08 14:40:36 -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
Serhiy Storchaka ea525a2d1a Issue #27078: Added BUILD_STRING opcode. Optimized f-strings evaluation. 2016-09-06 22:07:53 +03:00
Brett Cannon 3cebf93872 Implement the frame evaluation API aspect of PEP 523. 2016-09-05 15:33:46 -07:00
Raymond Hettinger 15f44ab043 Issue #27895: Spelling fixes (Contributed by Ville Skyttä). 2016-08-30 10:47:49 -07:00
Victor Stinner e90bdb19f2 Issue #27830: Revert, remove _PyFunction_FastCallKeywords() 2016-08-25 23:26:50 +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 6e2333dfdf PyEval_CallObjectWithKeywords() doesn't inc/decref
Issue #27809: PyEval_CallObjectWithKeywords() doesn't increment temporary the
reference counter of the args tuple (positional arguments). The caller already
holds a strong reference to it.
2016-08-23 00:25:01 +02:00
Victor Stinner 155ea65e5c PyEval_CallObjectWithKeywords() uses fast call with kwargs
Issue #27809. _PyObject_FastCallDict() now supports keyword arguments, and so
the args==NULL fast-path can also be used when kwargs is not NULL.
2016-08-22 23:26:00 +02:00
Victor Stinner 6fea7f7ffc Issue #27809: Cleanup _PyEval_EvalCodeWithName()
* Rename nm to name
* PEP 7: add { ... } to if/else blocks
2016-08-22 23:17:30 +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
Victor Stinner 2eedc119c2 Optimize call to Python function without argument
Issue #27128. When a Python function is called with no arguments, but all
parameters have a default value: use default values as arguments for the fast
path.
2016-08-22 12:29:42 +02:00
Victor Stinner df142fdc4b import_name() now uses fast call
Issue #27128: import_name() now calls _PyObject_FastCall() to avoid the
creation of a temporary tuple.
2016-08-20 00:44:42 +02:00
Victor Stinner 8a31c82093 Fix PyObject_Call() parameter names
Issue #27128: arg=>args, kw=>kwargs.

Same change for PyEval_CallObjectWithKeywords().
2016-08-19 17:12:23 +02:00
Victor Stinner 3f745bf1d9 PyEval_CallObjectWithKeywords() uses fast call
Issue #27128: Modify PyEval_CallObjectWithKeywords() to use
_PyObject_FastCall() when args==NULL and kw==NULL. It avoids the creation of a
temporary empty tuple for positional arguments.
2016-08-19 16:42:42 +02:00