mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
gh-106320: Remove private _PyObject C API (#107147)
Move private debug _PyObject functions to the internal C API (pycore_object.h): * _PyDebugAllocatorStats() * _PyObject_CheckConsistency() * _PyObject_DebugTypeStats() * _PyObject_IsFreed() No longer export most of these functions, except of _PyObject_IsFreed(). Move test functions using _PyObject_IsFreed() from _testcapi to _testinternalcapi. check_pyobject_is_freed() test no longer catch _testcapi.error: the tested function cannot raise _testcapi.error.
This commit is contained in:
parent
0810b0c435
commit
0d6dfd68d2
12 changed files with 116 additions and 112 deletions
|
|
@ -14,6 +14,27 @@ extern "C" {
|
|||
#include "pycore_pystate.h" // _PyInterpreterState_GET()
|
||||
#include "pycore_runtime.h" // _PyRuntime
|
||||
|
||||
/* Check if an object is consistent. For example, ensure that the reference
|
||||
counter is greater than or equal to 1, and ensure that ob_type is not NULL.
|
||||
|
||||
Call _PyObject_AssertFailed() if the object is inconsistent.
|
||||
|
||||
If check_content is zero, only check header fields: reduce the overhead.
|
||||
|
||||
The function always return 1. The return value is just here to be able to
|
||||
write:
|
||||
|
||||
assert(_PyObject_CheckConsistency(obj, 1)); */
|
||||
extern int _PyObject_CheckConsistency(PyObject *op, int check_content);
|
||||
|
||||
extern void _PyDebugAllocatorStats(FILE *out, const char *block_name,
|
||||
int num_blocks, size_t sizeof_block);
|
||||
|
||||
extern void _PyObject_DebugTypeStats(FILE *out);
|
||||
|
||||
// Export for shared _testinternalcapi extension
|
||||
PyAPI_DATA(int) _PyObject_IsFreed(PyObject *);
|
||||
|
||||
/* We need to maintain an internal copy of Py{Var}Object_HEAD_INIT to avoid
|
||||
designated initializer conflicts in C++20. If we use the deinition in
|
||||
object.h, we will be mixing designated and non-designated initializers in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue