@@ -959,6 +959,17 @@ iframe_getlasti(PyObject *self, PyObject *frame)
959959 return PyLong_FromLong (PyUnstable_InterpreterFrame_GetLasti (f ));
960960}
961961
962+ static PyObject *
963+ iframe_getframeobject (PyObject * self , PyObject * frame )
964+ {
965+ if (!PyFrame_Check (frame )) {
966+ PyErr_SetString (PyExc_TypeError , "argument must be a frame" );
967+ return NULL ;
968+ }
969+ struct _PyInterpreterFrame * f = ((PyFrameObject * )frame )-> f_frame ;
970+ return (PyObject * )PyUnstable_InterpreterFrame_GetFrameObject (f );
971+ }
972+
962973static PyObject *
963974code_returns_only_none (PyObject * self , PyObject * arg )
964975{
@@ -2529,6 +2540,7 @@ static PyMethodDef module_functions[] = {
25292540 {"iframe_getcode" , iframe_getcode , METH_O , NULL },
25302541 {"iframe_getline" , iframe_getline , METH_O , NULL },
25312542 {"iframe_getlasti" , iframe_getlasti , METH_O , NULL },
2543+ {"iframe_getframeobject" , iframe_getframeobject , METH_O , NULL },
25322544 {"code_returns_only_none" , code_returns_only_none , METH_O , NULL },
25332545 {"get_co_framesize" , get_co_framesize , METH_O , NULL },
25342546 {"get_co_localskinds" , get_co_localskinds , METH_O , NULL },
0 commit comments