summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. ↵Stefan Krah2017-08-211-1/+3
| | | | (#3157)
* bpo-31071: Avoid masking original TypeError in call with * unpacking (#2957)Serhiy Storchaka2017-08-031-29/+34
| | | when other arguments are passed.
* Spelling fixes (#2902)Ville Skyttä2017-08-031-1/+1
|
* bpo-30640: Fix undefined behavior in _PyFunction_FastCallDict() and ↵Zackery Spytz2017-07-311-1/+2
| | | | | PyEval_EvalCodeEx() (#2919) k + 1 was calculated with k = NULL.
* bpo-30854: Fix compile error when --without-threads (#2581)Masayuki Yamamoto2017-07-051-1/+1
| | | | | | * bpo-30854: Fix compile error when --without-threads * bpo-30854: fix news
* bpo-30703: Improve signal delivery (#2415)Antoine Pitrou2017-06-281-21/+54
| | | | | | | | | | | | | | | | | | | | * Improve signal delivery Avoid using Py_AddPendingCall from signal handler, to avoid calling signal-unsafe functions. * Remove unused function * Improve comments * Add stress test * Adapt for --without-threads * Add second stress test * Add NEWS blurb * Address comments @haypo
* Trivial cleanup: remove redundant variable stores in ceval.c (#2012)Adrian Wielgosik2017-06-231-6/+1
| | | Redundant code leftover from cleanup in #16191: the variable `err` is being written to, even though it wasn't used after that point.
* bpo-30604: clean up co_extra support (#2144)Dino Viehland2017-06-211-4/+4
| | | bpo-30604: port fix from 3.6 dropping binary compatibility tweaks
* bpo-16500: Use register_at_fork() in the threading module (#1843)Antoine Pitrou2017-05-281-18/+0
| | | | | | * bpo-16500: Use register_at_fork() in the threading module * Update comment at top of _after_fork()
* Doc nits for bpo-16500 (#1841)Antoine Pitrou2017-05-281-4/+4
| | | | | | * Doc nits for bpo-16500 * Fix more references
* bpo-30039: Don't run signal handlers while resuming a yield from stack (#1081)Nathaniel J. Smith2017-05-171-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* bpo-30281: Fix the default value for stop in PySlice_Unpack() (#1480)Xiang Zhang2017-05-101-1/+1
|
* bpo-29935: Fixed error messages in the index() method of tuple, list and ↵Serhiy Storchaka2017-03-301-7/+16
| | | | | deque (#887) when pass indices of wrong type.
* bpo-6532: Make the thread id an unsigned integer. (#781)Serhiy Storchaka2017-03-231-1/+1
| | | | | | | | | | | * 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().
* bpo-29849: fix a memory leak in import_from (GH-712)Xiang Zhang2017-03-211-10/+17
|
* bpo-29748: Added the slice index converter in Argument Clinic. (#549)Serhiy Storchaka2017-03-191-0/+7
|
* bpo-29676: fix lsprof can't profile C method call. (GH523)INADA Naoki2017-03-071-1/+14
| | | | | | | | | | 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.
* bpo-28893: Set __cause__ for errors in async iteration protocol (#407)Yury Selivanov2017-03-031-3/+3
|
* bpo-29655: Fixed possible reference leaks in `import *`. (#301)Matthias Bussonnier2017-02-261-1/+4
| | | Patch by Matthias Bussonnier.
* bpo-28598: Support __rmod__ for RHS subclasses of str in % string formatting ↵Martijn Pieters2017-02-231-3/+9
| | | | | | | | 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.
* bpo-29546: Improve from-import error message with location (#103)Matthias Bussonnier2017-02-221-4/+21
| | | | bpo-29546: Improve from-import error message with location
* bpo-29546: Set 'path' on ImportError for ``from ... import ...`` (GH-91)Matthias Bussonnier2017-02-151-2/+10
|
* bpo-29524: Add Objects/call.c file (#12)Victor Stinner2017-02-121-239/+3
| | | | | | | | | * 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.
* Backed out changeset f23fa1f7b68fVictor Stinner2017-02-101-3/+239
| | | | | 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-101-239/+3
| | | | | | | | | | * 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 #29263: LOAD_METHOD support for C methodsINADA Naoki2017-02-021-6/+6
| | | | Calling builtin method is at most 10% faster.
* Document that _PyFunction_FastCallDict() must copy kwargsVictor Stinner2017-02-011-0/+2
| | | | | Issue #29318: Caller and callee functions must not share the dictionary: kwargs must be copied.
* Rephrase !PyErr_Occurred() comment: may=>canVictor Stinner2017-01-181-2/+2
| | | | Issue #29259.
* Issue #26110: Add document for LOAD_METHOD and CALL_METHOD opcode.INADA Naoki2017-01-161-40/+32
| | | | Changed stack layout bit for "easy to explain."
* _PyEval_EvalCodeWithName(): remove redundant checkVictor Stinner2017-01-111-1/+2
| | | | Replace the runtime check with an assertion (just in case).
* Inline call_function()Victor Stinner2017-01-101-2/+4
| | | | | | | | | | | | | 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)
* Optimize _PyFunction_FastCallDict() when kwargs is {}Victor Stinner2017-01-031-3/+5
| | | | | Issue #28839: Optimize _PyFunction_FastCallDict() when kwargs is an empty dictionary, avoid the creation of an useless empty tuple.
* Issue #29049: Remove unnecessary Py_DECREFINADA Naoki2016-12-261-1/+1
|
* Issue #29049: Fix refleak introduced by f5eb0c4f5d37.INADA Naoki2016-12-261-1/+4
|
* Issue #29049: Call _PyObject_GC_TRACK() lazily when calling Python function.INADA Naoki2016-12-241-10/+21
| | | | Calling function is up to 5% faster.
* Issue #18896: Python function can now have more than 255 parameters.Serhiy Storchaka2016-12-161-1/+1
| | | | collections.namedtuple() now supports tuples with more than 255 elements.
* Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of ↵Serhiy Storchaka2016-12-161-2/+2
| | | | dict.
* Issue #26110: Add LOAD_METHOD/CALL_METHOD opcodes.Yury Selivanov2016-12-141-0/+97
| | | | | | | 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).
* Backed out changeset 99c34e47348bVictor Stinner2016-12-091-2/+2
| | | | The change broke test_gdb.
* Inline PyEval_EvalFrameEx() in callersVictor Stinner2016-12-091-2/+2
| | | | | | | | 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.
* Use _PyObject_CallNoArg()Victor Stinner2016-12-061-2/+2
| | | | | | | Replace: PyObject_CallFunctionObjArgs(callable, NULL) with: _PyObject_CallNoArg(callable)
* Use _PyObject_CallNoArg()Victor Stinner2016-12-061-2/+2
| | | | | | | Replace: PyObject_CallObject(callable, NULL) with: _PyObject_CallNoArg(callable)
* Uniformize argument names of "call" functionsVictor Stinner2016-12-061-3/+4
| | | | | | | | | | | | 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)
* Backed out changeset b9c9691c72c5Victor Stinner2016-12-041-3/+3
| | | | | | Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like _PyObject_CallArg1() uses more stack memory than PyObject_CallFunctionObjArgs().
* WITH_CLEANUP_START uses fastcallVictor Stinner2016-12-011-3/+10
| | | | | Modify WITH_CLEANUP_START bytecode: replace PyObject_CallFunctionObjArgs() with _PyObject_FastCall().
* Replace PyObject_CallFunctionObjArgs() with fastcallVictor Stinner2016-12-011-3/+3
| | | | | | | | | | | | | | * 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.
* call_function(): document PyMethod optimizationVictor Stinner2016-11-281-1/+5
|
* Remove CALL_PROFILE special buildVictor Stinner2016-11-281-91/+0
| | | | | | | | | | | 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.
* Merge 3.6Victor Stinner2016-11-241-0/+1
|\
| * Fix _PyGen_yf()Victor Stinner2016-11-241-0/+1
| | | | | | | | | | | | | | | | 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.