summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-36710: Add 'ceval' local variable to ceval.c (GH-12934)Victor Stinner2019-05-101-165/+204
| | | | | | | | | | | | | | | | | | | | | | | | | Add "struct _ceval_runtime_state *ceval = &_PyRuntime.ceval;" local variables to function to better highlight the dependency on the global variable _PyRuntime and to point directly to _PyRuntime.ceval field rather than on the larger _PyRuntime. Changes: * Add _PyRuntimeState_GetThreadState(runtime) macro. * Add _PyEval_AddPendingCall(ceval, ...) and _PyThreadState_Swap(gilstate, ...) functions. * _PyThreadState_GET() macro now calls _PyRuntimeState_GetThreadState() using &_PyRuntime. * Add 'ceval' parameter to COMPUTE_EVAL_BREAKER(), SIGNAL_PENDING_SIGNALS(), _PyEval_SignalAsyncExc(), _PyEval_SignalReceived() and _PyEval_FiniThreads() macros and functions. * Add 'tstate' parameter to call_function(), do_call_core() and do_raise(). * Add 'runtime' parameter to _Py_CURRENTLY_FINALIZING(), _Py_FinishPendingCalls() and _PyThreadState_DeleteExcept() macros and functions. * Declare 'runtime', 'tstate', 'ceval' and 'eval_breaker' variables as constant.
* bpo-36851: Clean the frame stack if the execution ends with a return and the ↵Pablo Galindo2019-05-091-7/+9
| | | | stack is not empty (GH-13191)
* bpo-36817: Add f-string debugging using '='. (GH-13123)Eric V. Smith2019-05-081-4/+6
| | | If a "=" is specified a the end of an f-string expression, the f-string will evaluate to the text of the expression, followed by '=', followed by the repr of the value of the expression.
* bpo-36475: Make PyThread_exit_thread with _Py_NO_RETURN (GH-13068)Victor Stinner2019-05-041-1/+0
|
* bpo-36540: PEP 570 -- Implementation (GH-12701)Pablo Galindo2019-04-291-18/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains the implementation of PEP570: Python positional-only parameters. * Update Grammar/Grammar with new typedarglist and varargslist * Regenerate grammar files * Update and regenerate AST related files * Update code object * Update marshal.c * Update compiler and symtable * Regenerate importlib files * Update callable objects * Implement positional-only args logic in ceval.c * Regenerate frozen data * Update standard library to account for positional-only args * Add test file for positional-only args * Update other test files to account for positional-only args * Add News entry * Update inspect module and related tests
* Revert "bpo-36356: Destroy the GIL at exit (GH-12453)" (GH613006)Victor Stinner2019-04-291-11/+5
| | | This reverts commit b36e5d627d4232a01850707eb78a5067f3fd77f4.
* bpo-36356: Destroy the GIL at exit (GH-12453)Victor Stinner2019-04-291-5/+11
| | | | | | * Add _PyEval_FiniThreads2(). _PyEval_FiniThreads() now only clears the pending lock, whereas _PyEval_FiniThreads2() destroys the GIL. * pymain_free() now calls _PyEval_FiniThreads2(). * Py_FinalizeEx() now calls _PyEval_FiniThreads().
* bpo-36475: Finalize PyEval_AcquireLock() and PyEval_AcquireThread() properly ↵Joannah Nanjekye2019-04-291-12/+16
| | | | | | | | (GH-12667) PyEval_AcquireLock() and PyEval_AcquireThread() now terminate the current thread if called while the interpreter is finalizing, making them consistent with PyEval_RestoreThread(), Py_END_ALLOW_THREADS, and PyGILState_Ensure().
* Fix typo in 'tandem' word (GH-12998) (GH-12998)Andrey2019-04-291-1/+1
|
* bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853)Victor Stinner2019-04-171-0/+4
| | | | | | | | | | | | | | | | | | | | Change PyAPI_FUNC(type), PyAPI_DATA(type) and PyMODINIT_FUNC macros of pyport.h when Py_BUILD_CORE_MODULE is defined. The Py_BUILD_CORE_MODULE define must be now be used to build a C extension as a dynamic library accessing Python internals: export the PyInit_xxx() function in DLL exports on Windows. Changes: * Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE now imply Py_BUILD_CORE directy in pyport.h. * ceval.c compilation now fails with an error if Py_BUILD_CORE is not defined, just to ensure that Python is build with the correct defines. * setup.py now compiles _pickle.c with Py_BUILD_CORE_MODULE define. * setup.py compiles _json.c with Py_BUILD_CORE_MODULE define, rather than Py_BUILD_CORE_BUILTIN define * PCbuild/pythoncore.vcxproj: Add Py_BUILD_CORE_BUILTIN define.
* bpo-33608: Revert "Factor out a private, per-interpreter ↵Eric Snow2019-04-121-78/+64
| | | | | _Py_AddPendingCall()." (gh-12806) This reverts commit f13c5c8b9401a9dc19e95d8b420ee100ac022208 (gh-12360).
* bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). ↵Eric Snow2019-04-121-64/+78
| | | | | (gh-12360) This is effectively an un-revert of #11617 and #12024 (reverted in #12159). Portions of those were merged in other PRs (with lower risk) and this represents the remainder. Note that I found 3 different bugs in the original PRs and have fixed them here.
* bpo-36370: Check for PyErr_Occurred() after PyImport_GetModule() (GH-12504)Stefan Krah2019-03-251-3/+3
|
* bpo-36333, bpo-36356: Fix _PyEval_FiniThreads() (GH-12432)Victor Stinner2019-03-191-2/+11
| | | _PyEval_FiniThreads() now free the pending lock.
* bpo-33608: Deal with pending calls relative to runtime shutdown. (gh-12246)Eric Snow2019-03-151-21/+61
|
* bpo-33608: Fix PyEval_InitThreads() warning (GH-12346)Victor Stinner2019-03-151-1/+1
| | | | | | | | The function has no return value. Fix the following warning on Windows: python\ceval.c(180): warning C4098: 'PyEval_InitThreads': 'void' function returning a value
* bpo-33608: Make sure locks in the runtime are properly re-created. (gh-12245)Eric Snow2019-03-091-39/+10
|
* bpo-33608: Minor cleanup related to pending calls. (gh-12247)Eric Snow2019-03-091-32/+48
|
* Simplify DISPATCH by hoisting eval_breaker ahead of time. (gh-12243)Eric Snow2019-03-091-2/+3
|
* Revert: bpo-33608: Factor out a private, per-interpreter ↵Victor Stinner2019-03-041-118/+82
| | | | | | | | | | | | | | | | | | | _Py_AddPendingCall(). (GH-11617) (GH-12159) * Revert "bpo-36097: Use only public C-API in the_xxsubinterpreters module (adding as necessary). (#12003)" This reverts commit bcfa450f210074e16feb761ae5b3e966a2532fcf. * Revert "bpo-33608: Simplify ceval's DISPATCH by hoisting eval_breaker ahead of time. (gh-12062)" This reverts commit bda918bf65a88560ec453aaba0758a9c0d49b449. * Revert "bpo-33608: Use _Py_AddPendingCall() in _PyCrossInterpreterData_Release(). (gh-12024)" This reverts commit b05b711a2cef6c6c381e01069dedac372e0b9fb2. * Revert "bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (GH-11617)" This reverts commit ef4ac967e2f3a9a18330cc6abe14adb4bc3d0465.
* bpo-33608: Simplify ceval's DISPATCH by hoisting eval_breaker ahead of time. ↵Eric Snow2019-03-011-2/+3
| | | | | (gh-12062) This includes fixes to various _Py_atomic_* macros.
* bpo-36030: Add _PyTuple_FromArray() function (GH-11954)Sergey Fedoseev2019-02-251-6/+1
|
* bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)Serhiy Storchaka2019-02-251-22/+54
|
* bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). ↵Eric Snow2019-02-241-82/+117
| | | | | | | (GH-11617) This involves moving the global "pending calls" state to PyInterpreterState. https://bugs.python.org/issue33608
* bpo-35724: Explicitly require the main interpreter for signal-handling. ↵Eric Snow2019-02-231-1/+8
| | | | | | | (GH-11530) Ensure that the main interpreter is active (in the main thread) for signal-handling operations. This is increasingly relevant as people use subinterpreters more. https://bugs.python.org/issue35724
* bpo-12822: use monotonic clock for condvar if possible (GH-11723)Inada Naoki2019-02-201-0/+1
|
* bpo-35634: Raise an error when first passed kwargs contains duplicated keys. ↵Serhiy Storchaka2019-01-121-48/+45
| | | | (GH-11438)
* bpo-35423: Stop using the "pending calls" machinery for signals. (gh-10972)Eric Snow2019-01-111-25/+83
| | | | | This change separates the signal handling trigger in the eval loop from the "pending calls" machinery. There is no semantic change and the difference in performance is insignificant. The change makes both components less confusing. It also eliminates the risk of changes to the pending calls affecting signal handling. This is particularly relevant for some upcoming pending calls changes I have in the works.
* bpo-35454: Fix miscellaneous minor issues in error handling. (#11077)Serhiy Storchaka2018-12-111-1/+1
| | | | | | * bpo-35454: Fix miscellaneous minor issues in error handling. * Fix a null pointer dereference.
* bpo-35444: Unify and optimize the helper for getting a builtin object. ↵Serhiy Storchaka2018-12-111-0/+14
| | | | | | | | (GH-11047) This speeds up pickling of some iterators. This fixes also error handling in pickling methods when fail to look up builtin "getattr".
* bpo-35441: Remove dead and buggy code related to PyList_SetItem(). (GH-11033)Zackery Spytz2018-12-081-2/+2
| | | | | | | | | | In _localemodule.c and selectmodule.c, remove dead code that would cause double decrefs if run. In addition, replace PyList_SetItem() with PyList_SET_ITEM() in cases where a new list is populated and there is no possibility of an error. In addition, check if the list changed size in the loop in array_array_fromlist().
* bpo-35081: Add Include/internal/pycore_tupleobject.h (GH-10705)Victor Stinner2018-11-251-0/+1
| | | | Move _PyTuple_ITEMS() to a new header file: Include/internal/pycore_tupleobject.h
* bpo-35081: Add Include/internal/pycore_object.h (GH-10640)Victor Stinner2018-11-211-0/+1
| | | | Move _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() from Include/objimpl.h to Include/internal/pycore_object.h.
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-121-1/+1
| | | | | | | | | | | | | | Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
* bpo-35199: Add an internal _PyTuple_ITEMS() macro (GH-10434)Victor Stinner2018-11-091-1/+1
| | | | | | | * _PyTuple_ITEMS() gives access to the tuple->ob_item field and cast the first argument to PyTupleObject*. This internal macro is only usable if Py_BUILD_CORE is defined. * Replace &PyTuple_GET_ITEM(ob, 0) with _PyTuple_ITEMS(ob). * Replace PyTuple_GET_ITEM(op, 1) with &_PyTuple_ITEMS(ob)[1].
* bpo-35081: Add _PyThreadState_GET() internal macro (GH-10266)Victor Stinner2018-11-011-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | | If Py_BUILD_CORE is defined, the PyThreadState_GET() macro access _PyRuntime which comes from the internal pycore_state.h header. Public headers must not require internal headers. Move PyThreadState_GET() and _PyInterpreterState_GET_UNSAFE() from Include/pystate.h to Include/internal/pycore_state.h, and rename PyThreadState_GET() to _PyThreadState_GET() there. The PyThreadState_GET() macro of pystate.h is now redefined when pycore_state.h is included, to use the fast _PyThreadState_GET(). Changes: * Add _PyThreadState_GET() macro * Replace "PyThreadState_GET()->interp" with _PyInterpreterState_GET_UNSAFE() * Replace PyThreadState_GET() with _PyThreadState_GET() in internal C files (compiled with Py_BUILD_CORE defined), but keep PyThreadState_GET() in the public header files. * _testcapimodule.c: replace PyThreadState_GET() with PyThreadState_Get(); the module is not compiled with Py_BUILD_CORE defined. * pycore_state.h now requires Py_BUILD_CORE to be defined.
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | * Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
* bpo-35081: Cleanup pystate.c and pystate.h (GH-10240)Victor Stinner2018-10-301-2/+1
| | | | | | | | | | | | * Remove _PyThreadState_Current * Replace GET_TSTATE() with PyThreadState_GET() * Replace GET_INTERP_STATE() with _PyInterpreterState_GET_UNSAFE() * Replace direct access to _PyThreadState_Current with PyThreadState_GET() * Replace _PyThreadState_Current with _PyRuntime.gilstate.tstate_current * Rename SET_TSTATE() to _PyThreadState_SET(), name more consistent with _PyThreadState_GET() * Update outdated comments
* Fix typos in comments (GH-9905)Quan Tian2018-10-191-1/+1
|
* bpo-31370: Remove references to threadless builds (#8805)Zackery Spytz2018-09-291-5/+1
| | | Support for threadless builds was removed in a6a4dc81.
* bpo-34125: Enable profiling of method_descriptor in all cases (GH-8416)jdemeyer2018-09-191-3/+27
| | | | | | `list.append([], None)` was profiled but `list.append([], None, **{})` was not profiled. Enable profiling for later case. https://bugs.python.org/issue34125
* closes bpo-34673: Tweaks to make ceval more editable. (GH-9289)Benjamin Peterson2018-09-171-136/+136
| | | | | Two major changes: - Move case statements out of the TARGET macro. - Move PREDICT macro invocations after the case label.
* bpo-34301: Add _PyInterpreterState_Get() helper function (GH-8592)Victor Stinner2018-08-031-5/+5
| | | | sys_setcheckinterval() now uses a local variable to parse arguments, before writing into interp->check_interval.
* bpo-34113: Fix a crash when using LLTRACE is on (GH-8517)costypetrisor2018-07-311-17/+27
| | | Fix a crash on negative STACKADJ() when Low-Level trace (LLTRACE) is enabled.
* bpo-34190: Fix reference leak in call_function() (GH-8413)jdemeyer2018-07-231-5/+8
|
* bpo-34126: Fix crashes while profiling invalid calls. (GH-8300)jdemeyer2018-07-211-4/+10
|
* bpo-34066: Disabled interruption before SETUP_WITH and BEFORE_ASYNC_WITH. ↵Serhiy Storchaka2018-07-091-4/+11
| | | | | | | (GH-8159) This will prevent emitting a resource warning when the execution was interrupted by Ctrl-C between calling open() and entering a 'with' block in "with open()".
* bpo-29673: fix gdb scripts pystack and pystackv (GH-6126)Marcel Plch2018-04-061-1/+1
|
* bpo-29922: Improve error messages in 'async with' (GH-6352)Serhiy Storchaka2018-04-021-0/+25
| | | when __aenter__() or __aexit__() return non-awaitable object.
* bpo-32932: More revealing error message when non-str objects in __all__ ↵Xiang Zhang2018-03-241-1/+27
| | | | (GH-5848)