11/* interpreters module */
22/* low-level access to interpreter primitives */
33
4- #ifndef Py_BUILD_CORE_BUILTIN
5- # define Py_BUILD_CORE_MODULE 1
6- #endif
7-
84#include "Python.h"
9- #include "pycore_interp.h" // _PyInterpreterState_GetMainModule()
10- #include "pycore_interp_id.h" // _PyInterpreterState_GetIDObject()
5+ #include "interpreteridobject.h"
116
127
138#define MODULE_NAME "_xxsubinterpreters"
@@ -400,7 +395,7 @@ _run_script(PyInterpreterState *interp, const char *codestr,
400395 _sharedns * shared , _sharedexception * sharedexc )
401396{
402397 PyObject * excval = NULL ;
403- PyObject * main_mod = _PyInterpreterState_GetMainModule (interp );
398+ PyObject * main_mod = PyUnstable_InterpreterState_GetMainModule (interp );
404399 if (main_mod == NULL ) {
405400 goto error ;
406401 }
@@ -531,7 +526,7 @@ interp_create(PyObject *self, PyObject *args, PyObject *kwds)
531526 }
532527 assert (tstate != NULL );
533528 PyInterpreterState * interp = PyThreadState_GetInterpreter (tstate );
534- PyObject * idobj = _PyInterpreterState_GetIDObject (interp );
529+ PyObject * idobj = PyInterpreterState_GetIDObject (interp );
535530 if (idobj == NULL ) {
536531 // XXX Possible GILState issues?
537532 save_tstate = PyThreadState_Swap (tstate );
@@ -561,7 +556,7 @@ interp_destroy(PyObject *self, PyObject *args, PyObject *kwds)
561556 }
562557
563558 // Look up the interpreter.
564- PyInterpreterState * interp = _PyInterpreterID_LookUp (id );
559+ PyInterpreterState * interp = PyInterpreterID_LookUp (id );
565560 if (interp == NULL ) {
566561 return NULL ;
567562 }
@@ -616,7 +611,7 @@ interp_list_all(PyObject *self, PyObject *Py_UNUSED(ignored))
616611
617612 interp = PyInterpreterState_Head ();
618613 while (interp != NULL ) {
619- id = _PyInterpreterState_GetIDObject (interp );
614+ id = PyInterpreterState_GetIDObject (interp );
620615 if (id == NULL ) {
621616 Py_DECREF (ids );
622617 return NULL ;
@@ -648,7 +643,7 @@ interp_get_current(PyObject *self, PyObject *Py_UNUSED(ignored))
648643 if (interp == NULL ) {
649644 return NULL ;
650645 }
651- return _PyInterpreterState_GetIDObject (interp );
646+ return PyInterpreterState_GetIDObject (interp );
652647}
653648
654649PyDoc_STRVAR (get_current_doc ,
@@ -662,7 +657,7 @@ interp_get_main(PyObject *self, PyObject *Py_UNUSED(ignored))
662657{
663658 // Currently, 0 is always the main interpreter.
664659 int64_t id = 0 ;
665- return _PyInterpreterID_New (id );
660+ return PyInterpreterID_New (id );
666661}
667662
668663PyDoc_STRVAR (get_main_doc ,
@@ -684,7 +679,7 @@ interp_run_string(PyObject *self, PyObject *args, PyObject *kwds)
684679 }
685680
686681 // Look up the interpreter.
687- PyInterpreterState * interp = _PyInterpreterID_LookUp (id );
682+ PyInterpreterState * interp = PyInterpreterID_LookUp (id );
688683 if (interp == NULL ) {
689684 return NULL ;
690685 }
@@ -750,7 +745,7 @@ interp_is_running(PyObject *self, PyObject *args, PyObject *kwds)
750745 return NULL ;
751746 }
752747
753- PyInterpreterState * interp = _PyInterpreterID_LookUp (id );
748+ PyInterpreterState * interp = PyInterpreterID_LookUp (id );
754749 if (interp == NULL ) {
755750 return NULL ;
756751 }
@@ -808,7 +803,7 @@ module_exec(PyObject *mod)
808803 }
809804
810805 // PyInterpreterID
811- if (PyModule_AddType (mod , & _PyInterpreterID_Type ) < 0 ) {
806+ if (PyModule_AddType (mod , & PyInterpreterID_Type ) < 0 ) {
812807 goto error ;
813808 }
814809
0 commit comments