summaryrefslogtreecommitdiffstats
path: root/Include/cpython
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2024-05-02 17:30:00 (GMT)
committerGitHub <noreply@github.com>2024-05-02 17:30:00 (GMT)
commit6bcbee09df9f6fa6496fb7f68b6d655f190903a7 (patch)
tree3805da0e3cb96c9d035b14fa4c7350b3030e0e89 /Include/cpython
parent2770d5caca42d48102f8e18210132a964c34af7c (diff)
downloadcpython-6bcbee09df9f6fa6496fb7f68b6d655f190903a7.zip
cpython-6bcbee09df9f6fa6496fb7f68b6d655f190903a7.tar.gz
cpython-6bcbee09df9f6fa6496fb7f68b6d655f190903a7.tar.bz2
gh-93502: Add new C-API functions to trace object creation and destruction (#115945)
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/object.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Include/cpython/object.h b/Include/cpython/object.h
index a6b93b9..c2830b7 100644
--- a/Include/cpython/object.h
+++ b/Include/cpython/object.h
@@ -510,3 +510,13 @@ PyAPI_FUNC(int) PyType_Unwatch(int watcher_id, PyObject *type);
* assigned, or 0 if a new tag could not be assigned.
*/
PyAPI_FUNC(int) PyUnstable_Type_AssignVersionTag(PyTypeObject *type);
+
+
+typedef enum {
+ PyRefTracer_CREATE = 0,
+ PyRefTracer_DESTROY = 1,
+} PyRefTracerEvent;
+
+typedef int (*PyRefTracer)(PyObject *, PyRefTracerEvent event, void *);
+PyAPI_FUNC(int) PyRefTracer_SetTracer(PyRefTracer tracer, void *data);
+PyAPI_FUNC(PyRefTracer) PyRefTracer_GetTracer(void**);