@@ -2533,109 +2533,6 @@ test_tstate_capi(PyObject *self, PyObject *Py_UNUSED(args))
25332533 Py_RETURN_NONE ;
25342534}
25352535
2536- static PyObject *
2537- frame_getlocals (PyObject * self , PyObject * frame )
2538- {
2539- if (!PyFrame_Check (frame )) {
2540- PyErr_SetString (PyExc_TypeError , "argument must be a frame" );
2541- return NULL ;
2542- }
2543- return PyFrame_GetLocals ((PyFrameObject * )frame );
2544- }
2545-
2546- static PyObject *
2547- frame_getglobals (PyObject * self , PyObject * frame )
2548- {
2549- if (!PyFrame_Check (frame )) {
2550- PyErr_SetString (PyExc_TypeError , "argument must be a frame" );
2551- return NULL ;
2552- }
2553- return PyFrame_GetGlobals ((PyFrameObject * )frame );
2554- }
2555-
2556- static PyObject *
2557- frame_getgenerator (PyObject * self , PyObject * frame )
2558- {
2559- if (!PyFrame_Check (frame )) {
2560- PyErr_SetString (PyExc_TypeError , "argument must be a frame" );
2561- return NULL ;
2562- }
2563- return PyFrame_GetGenerator ((PyFrameObject * )frame );
2564- }
2565-
2566- static PyObject *
2567- frame_getbuiltins (PyObject * self , PyObject * frame )
2568- {
2569- if (!PyFrame_Check (frame )) {
2570- PyErr_SetString (PyExc_TypeError , "argument must be a frame" );
2571- return NULL ;
2572- }
2573- return PyFrame_GetBuiltins ((PyFrameObject * )frame );
2574- }
2575-
2576- static PyObject *
2577- frame_getlasti (PyObject * self , PyObject * frame )
2578- {
2579- if (!PyFrame_Check (frame )) {
2580- PyErr_SetString (PyExc_TypeError , "argument must be a frame" );
2581- return NULL ;
2582- }
2583- int lasti = PyFrame_GetLasti ((PyFrameObject * )frame );
2584- if (lasti < 0 ) {
2585- assert (lasti == -1 );
2586- Py_RETURN_NONE ;
2587- }
2588- return PyLong_FromLong (lasti );
2589- }
2590-
2591- static PyObject *
2592- frame_new (PyObject * self , PyObject * args )
2593- {
2594- PyObject * code , * globals , * locals ;
2595- if (!PyArg_ParseTuple (args , "OOO" , & code , & globals , & locals )) {
2596- return NULL ;
2597- }
2598- if (!PyCode_Check (code )) {
2599- PyErr_SetString (PyExc_TypeError , "argument must be a code object" );
2600- return NULL ;
2601- }
2602- PyThreadState * tstate = PyThreadState_Get ();
2603-
2604- return (PyObject * )PyFrame_New (tstate , (PyCodeObject * )code , globals , locals );
2605- }
2606-
2607- static PyObject *
2608- test_frame_getvar (PyObject * self , PyObject * args )
2609- {
2610- PyObject * frame , * name ;
2611- if (!PyArg_ParseTuple (args , "OO" , & frame , & name )) {
2612- return NULL ;
2613- }
2614- if (!PyFrame_Check (frame )) {
2615- PyErr_SetString (PyExc_TypeError , "argument must be a frame" );
2616- return NULL ;
2617- }
2618-
2619- return PyFrame_GetVar ((PyFrameObject * )frame , name );
2620- }
2621-
2622- static PyObject *
2623- test_frame_getvarstring (PyObject * self , PyObject * args )
2624- {
2625- PyObject * frame ;
2626- const char * name ;
2627- if (!PyArg_ParseTuple (args , "Oy" , & frame , & name )) {
2628- return NULL ;
2629- }
2630- if (!PyFrame_Check (frame )) {
2631- PyErr_SetString (PyExc_TypeError , "argument must be a frame" );
2632- return NULL ;
2633- }
2634-
2635- return PyFrame_GetVarString ((PyFrameObject * )frame , name );
2636- }
2637-
2638-
26392536static PyObject *
26402537gen_get_code (PyObject * self , PyObject * gen )
26412538{
@@ -3599,14 +3496,6 @@ static PyMethodDef TestMethods[] = {
35993496 {"type_get_tp_mro" , type_get_tp_mro , METH_O },
36003497 {"get_basic_static_type" , get_basic_static_type , METH_VARARGS , NULL },
36013498 {"test_tstate_capi" , test_tstate_capi , METH_NOARGS , NULL },
3602- {"frame_getlocals" , frame_getlocals , METH_O , NULL },
3603- {"frame_getglobals" , frame_getglobals , METH_O , NULL },
3604- {"frame_getgenerator" , frame_getgenerator , METH_O , NULL },
3605- {"frame_getbuiltins" , frame_getbuiltins , METH_O , NULL },
3606- {"frame_getlasti" , frame_getlasti , METH_O , NULL },
3607- {"frame_new" , frame_new , METH_VARARGS , NULL },
3608- {"frame_getvar" , test_frame_getvar , METH_VARARGS , NULL },
3609- {"frame_getvarstring" , test_frame_getvarstring , METH_VARARGS , NULL },
36103499 {"gen_get_code" , gen_get_code , METH_O , NULL },
36113500 {"get_feature_macros" , get_feature_macros , METH_NOARGS , NULL },
36123501 {"test_code_api" , test_code_api , METH_NOARGS , NULL },
@@ -4404,6 +4293,9 @@ PyInit__testcapi(void)
44044293 if (_PyTestCapi_Init_Import (m ) < 0 ) {
44054294 return NULL ;
44064295 }
4296+ if (_PyTestCapi_Init_Frame (m ) < 0 ) {
4297+ return NULL ;
4298+ }
44074299
44084300 PyState_AddModule (m , & _testcapimodule );
44094301 return m ;
0 commit comments