| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
| |
Some inline functions use mixed declarations and code. These end up
visible in third-party code that includes Python.h, which might not be
using a C99 compiler. Fix by moving the declarations first, like in
the old days.
|
|
|
|
|
|
|
| |
* Revert "bpo-39087: Add _PyUnicode_GetUTF8Buffer() (GH-17659)"
This reverts commit c7ad974d341d3edb6b9d2a2dcae4d3d4794ada6b.
* Update unicodeobject.h
|
|
|
| |
Co-authored-by: Victor Stinner <vstinner@python.org>
|
|
|
|
| |
Add PyThreadState_GetInterpreter(tstate): get the interpreter of a
Python thread state.
|
|
|
|
|
|
| |
* Rename _PyInterpreterState_Get() to PyInterpreterState_Get() and
move it the limited C API.
* Add _PyInterpreterState_Get() alias to PyInterpreterState_Get() for
backward compatibility with Python 3.8.
|
|
|
|
|
|
| |
Py_TRASHCAN_BEGIN_CONDITION and Py_TRASHCAN_END macro no longer
access PyThreadState attributes, but call new private
_PyTrash_begin() and _PyTrash_end() functions which hide
implementation details.
|
|
|
|
|
|
|
|
|
| |
* sys.settrace(), sys.setprofile() and _lsprof.Profiler.enable() now
properly report PySys_Audit() error if "sys.setprofile" or
"sys.settrace" audit event is denied.
* Add _PyEval_SetProfile() and _PyEval_SetTrace() function: similar
to PyEval_SetProfile() and PyEval_SetTrace() but take a tstate
parameter and return -1 on error.
* Add _PyObject_FastCallTstate() function.
|
|
|
|
|
|
| |
Move the static inline function flavor of Py_EnterRecursiveCall() and
Py_LeaveRecursiveCall() to the internal C API: they access
PyThreadState attributes. The limited C API provides regular
functions which hide implementation details.
|
|
|
|
|
|
|
|
|
|
|
|
| |
PyInterpreterState.eval_frame function now requires a tstate (Python
thread state) parameter.
Add private functions to the C API to get and set the frame
evaluation function:
* Add tstate parameter to _PyFrameEvalFunction function type.
* Add _PyInterpreterState_GetEvalFrameFunc() and
_PyInterpreterState_SetEvalFrameFunc() functions.
* Add tstate parameter to _PyEval_EvalFrameDefault().
|
|
|
|
| |
_PyGILState_Init() now returns PyStatus rather than calling
Py_FatalError() on failure.
|
|
|
|
|
|
|
|
|
| |
* Remove the slice type.
* Make Slice a kind of the expr type instead of the slice type.
* Replace ExtSlice(slices) with Tuple(slices, Load()).
* Replace Index(value) with a value itself.
All non-terminal nodes in AST for expressions are now of the expr type.
|
|
|
|
| |
Deprecated PyEval_InitThreads() and PyEval_ThreadsInitialized().
Calling PyEval_InitThreads() now does nothing.
|
|
|
|
|
|
|
|
| |
PyGILState_Ensure() doesn't call PyEval_InitThreads() anymore when a
new Python thread state is created. The GIL is created by
Py_Initialize() since Python 3.7, it's not needed to call
PyEval_InitThreads() explicitly.
Add an assertion to ensure that the GIL is already created.
|
| |
|
|
|
|
| |
Py_Initialize() calls PyEval_InitThreads() since Python 3.7. It's no
longer needed to call it explicitly.
|
|
|
|
|
| |
mode. (GH-16329)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Py_FatalError() function is replaced with a macro which logs
automatically the name of the current function, unless the
Py_LIMITED_API macro is defined.
Changes:
* Add _Py_FatalErrorFunc() function.
* Remove the function name from the message of Py_FatalError() calls
which included the function name.
* Update tests.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Convert _PyRuntimeState.finalizing field to an atomic variable:
* Rename it to _finalizing
* Change its type to _Py_atomic_address
* Add _PyRuntimeState_GetFinalizing() and _PyRuntimeState_SetFinalizing()
functions
* Remove _Py_CURRENTLY_FINALIZING() function: replace it with testing
directly _PyRuntimeState_GetFinalizing() value
Convert _PyRuntimeState_GetThreadState() to static inline function.
|
|
|
| |
Add _PyObject_CAST_CONST() macro: cast a pointer to (const PyObject *).
|
|
|
|
|
|
|
|
| |
The AST "Suite" node is no longer used and it can be removed from the ASDL definition and related structures (compiler, visitors, ...).
Co-Authored-By: Victor Stinner <vstinner@python.org>
Co-authored-by: Brett Cannon <54418+brettcannon@users.noreply.github.com>
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
* Add _PyWarnings_InitState() which only initializes the _warnings
module state (tstate->interp->warnings) without creating a module
object
* Py_InitializeFromConfig() now calls _PyWarnings_InitState() instead
of _PyWarnings_Init()
* Rename also private functions of _warnings.c to avoid confusion
between the public C API and the private C API.
|
| |
|
| |
|
| |
|
|
|
|
| |
Update PyXXX_Check() macros in Include/ to use
the new Py_IS_TYPE function.
|
|
|
| |
Co-Author: Neil Schemenauer <nas-github@arctrix.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move CPython C API from Include/fileutils.h into a new
Include/cpython/fileutils.h header file which is included by
Include/fileutils.h.
Exclude the following private symbols from the limited C API:
* _Py_error_handler
* _Py_GetErrorHandler()
* _Py_DecodeLocaleEx()
* _Py_EncodeLocaleEx()
|
|
|
|
|
|
|
|
|
| |
Add Include/cpython/bytearrayobject.h and
Include/cpython/bytesobject.h header files.
Move CPython C API from Include/bytesobject.h into a new
Include/cpython/bytesobject.h header file which is included by
Include/bytesobject.h. Do a similar change for
Include/bytearrayobject.h.
|
|
|
|
|
|
|
| |
Move the dtoa.h header file to the internal C API as pycore_dtoa.h:
it only contains private functions (prefixed by "_Py").
The math and cmath modules must now be compiled with the
Py_BUILD_CORE macro defined.
|
|
|
|
|
| |
Move the bytes_methods.h header file to the internal C API as
pycore_bytes_methods.h: it only contains private symbols (prefixed by
"_Py"), except of the PyDoc_STRVAR_shared() macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The bulk of this patch was generated automatically with:
for name in \
PyObject_Vectorcall \
Py_TPFLAGS_HAVE_VECTORCALL \
PyObject_VectorcallMethod \
PyVectorcall_Function \
PyObject_CallOneArg \
PyObject_CallMethodNoArgs \
PyObject_CallMethodOneArg \
;
do
echo $name
git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g"
done
old=_PyObject_FastCallDict
new=PyObject_VectorcallDict
git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g"
and then cleaned up:
- Revert changes to in docs & news
- Revert changes to backcompat defines in headers
- Nudge misaligned comments
|
|
|
| |
Add Py_SET_SIZE() function to set the size of an object.
|
|
|
|
|
|
|
|
|
| |
Move listobject.h code surrounded by "#ifndef Py_LIMITED_API"
to a new Include/cpython/listobject.h header file.
Add cpython/ header files to Makefile.pre.in and pythoncore project
of PCbuild.
Add _PyList_CAST() macro.
|
|
|
| |
Add Py_SET_TYPE() function to set the type of an object.
|
|
|
| |
Replace direct access to PyObject.ob_type with Py_TYPE().
|
|
|
| |
Only define PyTypeObject type once.
|
|
|
|
| |
Add a Py_SET_REFCNT() function to set the reference counter of an
object.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add backcompat defines and move non-limited API declaration to cpython/
This partially reverts commit 2ff58a24e8a1c7e290d025d69ebaea0bbead3b8c
which added PyObject_CallNoArgs to the 3.9+ stable ABI. This should not
be done; there are enough other call APIs in the stable ABI to choose from.
* Adjust documentation
Mark all newly public functions as added in 3.9.
Add a note about the 3.8 provisional names.
Add notes on public API.
* Put PyObject_CallNoArgs back in the limited API
* Rename PyObject_FastCallDict to PyObject_VectorcallDict
|
| |
|
|
|
|
|
|
| |
_Py_AddToAllObjects() is used in bltinmodule.c and typeobject.c when
Py_TRACE_REFS is defined.
Fix Py_TRACE_REFS build.
|
|
|
|
|
|
| |
Add a fast-path for UTF-8 encoding in PyUnicode_EncodeFSDefault()
and PyUnicode_DecodeFSDefaultAndSize().
Add _PyUnicode_FiniEncodings() helper function for _PyUnicode_Fini().
|
|
|
| |
Replace "struct _typeobject" with PyTypeObject in object.h.
|
|
|
|
| |
Convert PyType_HasFeature(), PyType_Check() and PyType_CheckExact()
macros to static inline functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the limited C API, PyObject_INIT() and PyObject_INIT_VAR() are now
defined as aliases to PyObject_Init() and PyObject_InitVar() to make
their implementation opaque. It avoids to leak implementation details
in the limited C API.
Exclude the following functions from the limited C API, move them
from object.h to cpython/object.h:
* _Py_NewReference()
* _Py_ForgetReference()
* _PyTraceMalloc_NewReference()
* _Py_GetRefTotal()
|
|
|
|
|
|
|
|
| |
Exclude trashcan mechanism from the limited C API: it requires access to
PyTypeObject and PyThreadState structure fields, whereas these structures
are opaque in the limited C API.
The trashcan mechanism never worked with the limited C API. Move it
from object.h to cpython/object.h.
|