11// TypeVar, TypeVarTuple, and ParamSpec
22#include "Python.h"
3- #include "pycore_object.h" // _PyObject_GC_TRACK/UNTRACK
3+ #include "pycore_object.h" // _PyObject_GC_TRACK/UNTRACK
44#include "pycore_typevarobject.h"
55#include "pycore_unionobject.h" // _Py_union_type_or
66#include "structmember.h"
@@ -144,7 +144,7 @@ static int
144144contains_typevartuple (PyTupleObject * params )
145145{
146146 Py_ssize_t n = PyTuple_GET_SIZE (params );
147- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .typevartuple_type ;
147+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .typevartuple_type ;
148148 for (Py_ssize_t i = 0 ; i < n ; i ++ ) {
149149 PyObject * param = PyTuple_GET_ITEM (params , i );
150150 if (Py_IS_TYPE (param , tp )) {
@@ -165,7 +165,7 @@ unpack_typevartuples(PyObject *params)
165165 if (new_params == NULL ) {
166166 return NULL ;
167167 }
168- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .typevartuple_type ;
168+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .typevartuple_type ;
169169 for (Py_ssize_t i = 0 ; i < n ; i ++ ) {
170170 PyObject * param = PyTuple_GET_ITEM (params , i );
171171 if (Py_IS_TYPE (param , tp )) {
@@ -291,7 +291,7 @@ typevar_alloc(PyObject *name, PyObject *bound, PyObject *evaluate_bound,
291291 bool covariant , bool contravariant , bool infer_variance ,
292292 PyObject * module )
293293{
294- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .typevar_type ;
294+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .typevar_type ;
295295 assert (tp != NULL );
296296 typevarobject * tv = PyObject_GC_New (typevarobject , tp );
297297 if (tv == NULL ) {
@@ -576,7 +576,7 @@ paramspecargs_repr(PyObject *self)
576576{
577577 paramspecattrobject * psa = (paramspecattrobject * )self ;
578578
579- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .paramspec_type ;
579+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .paramspec_type ;
580580 if (Py_IS_TYPE (psa -> __origin__ , tp )) {
581581 return PyUnicode_FromFormat ("%U.args" ,
582582 ((paramspecobject * )psa -> __origin__ )-> name );
@@ -656,7 +656,7 @@ paramspeckwargs_repr(PyObject *self)
656656{
657657 paramspecattrobject * psk = (paramspecattrobject * )self ;
658658
659- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .paramspec_type ;
659+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .paramspec_type ;
660660 if (Py_IS_TYPE (psk -> __origin__ , tp )) {
661661 return PyUnicode_FromFormat ("%U.kwargs" ,
662662 ((paramspecobject * )psk -> __origin__ )-> name );
@@ -789,14 +789,14 @@ static PyMemberDef paramspec_members[] = {
789789static PyObject *
790790paramspec_args (PyObject * self , void * unused )
791791{
792- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .paramspecargs_type ;
792+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .paramspecargs_type ;
793793 return (PyObject * )paramspecattr_new (tp , self );
794794}
795795
796796static PyObject *
797797paramspec_kwargs (PyObject * self , void * unused )
798798{
799- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .paramspeckwargs_type ;
799+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .paramspeckwargs_type ;
800800 return (PyObject * )paramspecattr_new (tp , self );
801801}
802802
@@ -810,7 +810,7 @@ static paramspecobject *
810810paramspec_alloc (PyObject * name , PyObject * bound , bool covariant ,
811811 bool contravariant , bool infer_variance , PyObject * module )
812812{
813- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .paramspec_type ;
813+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .paramspec_type ;
814814 paramspecobject * ps = PyObject_GC_New (paramspecobject , tp );
815815 if (ps == NULL ) {
816816 return NULL ;
@@ -1059,7 +1059,7 @@ static PyMemberDef typevartuple_members[] = {
10591059static typevartupleobject *
10601060typevartuple_alloc (PyObject * name , PyObject * module )
10611061{
1062- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .typevartuple_type ;
1062+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .typevartuple_type ;
10631063 typevartupleobject * tvt = PyObject_GC_New (typevartupleobject , tp );
10641064 if (tvt == NULL ) {
10651065 return NULL ;
@@ -1598,7 +1598,7 @@ _Py_subscript_generic(PyThreadState* unused, PyObject *params)
15981598{
15991599 params = unpack_typevartuples (params );
16001600
1601- PyInterpreterState * interp = PyInterpreterState_Get ();
1601+ PyInterpreterState * interp = _PyInterpreterState_GET ();
16021602 if (interp -> cached_objects .generic_type == NULL ) {
16031603 PyErr_SetString (PyExc_SystemError , "Cannot find Generic type" );
16041604 return NULL ;
0 commit comments