mirror of
https://github.com/python/cpython.git
synced 2025-10-14 18:59:46 +00:00
GH-131238: More refactoring of core header files (GH-131351)
Adds new pycore_stats.h header file to help break dependencies involving the pycore_code.h header.
This commit is contained in:
parent
bb0268f60d
commit
a45f25361d
51 changed files with 264 additions and 187 deletions
|
@ -14,6 +14,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include "pycore_object_deferred.h"
|
||||
#include "pycore_object.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -639,6 +640,24 @@ PyStackRef_FunctionCheck(_PyStackRef stackref)
|
|||
return PyFunction_Check(PyStackRef_AsPyObjectBorrow(stackref));
|
||||
}
|
||||
|
||||
#ifdef Py_GIL_DISABLED
|
||||
|
||||
static inline int
|
||||
_Py_TryIncrefCompareStackRef(PyObject **src, PyObject *op, _PyStackRef *out)
|
||||
{
|
||||
if (_PyObject_HasDeferredRefcount(op)) {
|
||||
*out = (_PyStackRef){ .bits = (intptr_t)op | Py_TAG_DEFERRED };
|
||||
return 1;
|
||||
}
|
||||
if (_Py_TryIncrefCompare(src, op)) {
|
||||
*out = PyStackRef_FromPyObjectSteal(op);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue