| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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".
|
| |
|
| |
|
|
|
|
|
| |
(#2035)
MemoryError raised when normalizing a RecursionError raised during exception normalization now not always causes a fatal error.
|
| |
|
|
|
| |
Move exception state information from frame objects to coroutine (generator/thread) object where it belongs.
|
|
|
|
| |
exception with a bad __module__ attribute. (#3539)
|
|
|
|
|
|
|
| |
* group the (stateful) runtime globals into various topical structs
* consolidate the topical structs under a single top-level _PyRuntimeState struct
* add a check-c-globals.py script that helps identify runtime globals
Other globals are excluded (see globals.txt and check-c-globals.py).
|
|
|
| |
According to the comment, there was previously a call to PyObject_IsSubclass() involved which could fail, but since it was replaced with a call to PyType_IsSubtype(), it can no longer fail.
|
|\ |
|
| |\ |
|
| | |
| | |
| | |
| | | |
Based on patch by Michael Layzell.
|
|\ \ \
| |/ /
| | |
| | | |
PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
|
| |\ \
| | |/
| | |
| | | |
PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
|
| | |
| | |
| | |
| | | |
PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | | |
functions.
|
|\ \ \
| |/ /
| | |
| | |
| | |
| | | |
The latter function is more readable, faster and doesn't raise exceptions.
Based on patch by Xiang Zhang.
|
| |\ \
| | |/
| | |
| | |
| | |
| | | |
The latter function is more readable, faster and doesn't raise exceptions.
Based on patch by Xiang Zhang.
|
| | |
| | |
| | |
| | |
| | |
| | | |
The latter function is more readable, faster and doesn't raise exceptions.
Based on patch by Xiang Zhang.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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()
|
|/ /
| |
| |
| |
| | |
It seems like _PyThreadState_UncheckedGet() is not inlined as expected, even
when using gcc -O3.
|
| |
| |
| |
| |
| |
| |
| |
| | |
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]
|
|\ \
| |/
| |
| | |
_PyErr_ChainExceptions().
|
| |
| |
| |
| | |
_PyErr_ChainExceptions().
|
| | |
|
| | |
|
|/
|
|
|
| |
Issue #27809: Helper function optimized to create an exception: use fastcall
whenever possible.
|
|
|
|
| |
Patch by Ofer Schwarz.
|
|
|
|
| |
in places where Py_DECREF was used.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Issue #26154: Add a new private _PyThreadState_UncheckedGet() function which
gets the current thread state, but don't call Py_FatalError() if it is NULL.
Python 3.5.1 removed the _PyThreadState_Current symbol from the Python C API to
no more expose complex and private atomic types. Atomic types depends on the
compiler or can even depend on compiler options. The new function
_PyThreadState_UncheckedGet() allows to get the variable value without having
to care of the exact implementation of atomic types.
Changes:
* Replace direct usage of the _PyThreadState_Current variable with a call to
_PyThreadState_UncheckedGet().
* In pystate.c, replace direct usage of the _PyThreadState_Current variable
with the PyThreadState_GET() macro for readability.
* Document also PyThreadState_Get() in pystate.h
|
|
|
|
|
| |
This patch is manually crafted and contains changes that couldn't be handled
automatically.
|
| |
|
|\
| |
| |
| | |
Patch by Martin Panter.
|
| |
| |
| |
| | |
Patch by Martin Panter.
|
| |
| |
| |
| |
| | |
current exception because they can run arbitrary Python code and so no
exception must be set.
|
| |
| |
| |
| |
| | |
* If fopen() fails, OSError is raised with the original filename object.
* The GIL is now released while calling fopen()
|
|\ \
| |/
| |
| | |
_PyErr_ChainExceptions() function.
|
| |
| |
| |
| | |
_PyErr_ChainExceptions() function.
|
|/
|
|
| |
but accepting a `va_list` argument.
|
| |
|
|
|
|
|
|
| |
now register both filenames in the exception on failure.
This required adding new C API functions allowing OSError exceptions
to reference two filenames instead of one.
|
|
|
|
|
|
|
| |
are used.
Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
|
|
|
|
|
|
|
| |
_PyUnicode_CompareWithId() is faster than PyUnicode_CompareWithASCIIString()
when both strings are equal and interned.
Add also _PyId_builtins identifier for "builtins" common string.
|
|
|
|
|
|
|
| |
instead of creating temporary Unicode string objects
Add also more identifiers in pythonrun.c to avoid temporary Unicode string
objets for the interactive interpreter.
|