From f69e40797e176bdbbf60ec770ba92278f868808f Mon Sep 17 00:00:00 2001 From: Dino Viehland Date: Thu, 1 Aug 2024 14:30:58 -0700 Subject: [PATCH] Remove Ci_TypeRaisingCallback/Ci_hook_type_pre_setattr Summary: We now add a dictionary watcher for listening to changes to a type's dictionary, and when they occur, we initialize the type for patching. Reviewed By: alexmalyshev Differential Revision: D60084797 fbshipit-source-id: af389864b4690eca6e6bde92d13f8b79e77ad44a --- Include/cinder/hooks.h | 3 --- Objects/typeobject.c | 3 --- Python/cinderhooks.c | 1 - 3 files changed, 7 deletions(-) diff --git a/Include/cinder/hooks.h b/Include/cinder/hooks.h index 210f9f232dd..46e69ef8a46 100644 --- a/Include/cinder/hooks.h +++ b/Include/cinder/hooks.h @@ -48,9 +48,6 @@ CiAPI_DATA(Ci_HookType_ShadowFrame_WalkAndPopulate) Ci_hook_ShadowFrame_WalkAndPopulate; /* Hooks for Static Python. */ -typedef int(*Ci_TypeRaisingCallback)(PyTypeObject *type); -CiAPI_DATA(Ci_TypeRaisingCallback) Ci_hook_type_pre_setattr; - typedef int(*Ci_TypeAttrRaisingCallback)(PyTypeObject *type, PyObject *name, PyObject *value); CiAPI_DATA(Ci_TypeAttrRaisingCallback) Ci_hook_type_setattr; diff --git a/Objects/typeobject.c b/Objects/typeobject.c index a03b3cddfe9..0f83a191201 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -4398,9 +4398,6 @@ type_setattro(PyTypeObject *type, PyObject *name, PyObject *value) existing = PyDict_GetItem(type->tp_dict, name); Py_XINCREF(existing); } - if (Ci_hook_type_pre_setattr) { - Ci_hook_type_pre_setattr(type); - } res = _PyObject_GenericSetAttrWithDict((PyObject *)type, name, value, NULL); if (res == 0) { /* Clear the VALID_VERSION flag of 'type' and all its diff --git a/Python/cinderhooks.c b/Python/cinderhooks.c index 01cc2633d2b..3283aaabcc1 100644 --- a/Python/cinderhooks.c +++ b/Python/cinderhooks.c @@ -22,7 +22,6 @@ Ci_HookType_ShadowFrame_GetModuleName_JIT Ci_hook_ShadowFrame_GetModuleName_JIT Ci_HookType_ShadowFrame_WalkAndPopulate Ci_hook_ShadowFrame_WalkAndPopulate = NULL; /* Static Python. */ -Ci_TypeRaisingCallback Ci_hook_type_pre_setattr = NULL; Ci_TypeAttrRaisingCallback Ci_hook_type_setattr = NULL; Ci_HookType_PyCMethod_New Ci_hook_PyCMethod_New = NULL; Ci_HookType_PyDescr_NewMethod Ci_hook_PyDescr_NewMethod = NULL;