1
1
// TypeVar, TypeVarTuple, and ParamSpec
2
2
#include "Python.h"
3
- #include "pycore_object.h" // _PyObject_GC_TRACK/UNTRACK
3
+ #include "pycore_object.h" // _PyObject_GC_TRACK/UNTRACK
4
4
#include "pycore_typevarobject.h"
5
5
#include "pycore_unionobject.h" // _Py_union_type_or
6
6
#include "structmember.h"
@@ -144,7 +144,7 @@ static int
144
144
contains_typevartuple (PyTupleObject * params )
145
145
{
146
146
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 ;
148
148
for (Py_ssize_t i = 0 ; i < n ; i ++ ) {
149
149
PyObject * param = PyTuple_GET_ITEM (params , i );
150
150
if (Py_IS_TYPE (param , tp )) {
@@ -165,7 +165,7 @@ unpack_typevartuples(PyObject *params)
165
165
if (new_params == NULL ) {
166
166
return NULL ;
167
167
}
168
- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .typevartuple_type ;
168
+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .typevartuple_type ;
169
169
for (Py_ssize_t i = 0 ; i < n ; i ++ ) {
170
170
PyObject * param = PyTuple_GET_ITEM (params , i );
171
171
if (Py_IS_TYPE (param , tp )) {
@@ -291,7 +291,7 @@ typevar_alloc(PyObject *name, PyObject *bound, PyObject *evaluate_bound,
291
291
bool covariant , bool contravariant , bool infer_variance ,
292
292
PyObject * module )
293
293
{
294
- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .typevar_type ;
294
+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .typevar_type ;
295
295
assert (tp != NULL );
296
296
typevarobject * tv = PyObject_GC_New (typevarobject , tp );
297
297
if (tv == NULL ) {
@@ -576,7 +576,7 @@ paramspecargs_repr(PyObject *self)
576
576
{
577
577
paramspecattrobject * psa = (paramspecattrobject * )self ;
578
578
579
- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .paramspec_type ;
579
+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .paramspec_type ;
580
580
if (Py_IS_TYPE (psa -> __origin__ , tp )) {
581
581
return PyUnicode_FromFormat ("%U.args" ,
582
582
((paramspecobject * )psa -> __origin__ )-> name );
@@ -656,7 +656,7 @@ paramspeckwargs_repr(PyObject *self)
656
656
{
657
657
paramspecattrobject * psk = (paramspecattrobject * )self ;
658
658
659
- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .paramspec_type ;
659
+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .paramspec_type ;
660
660
if (Py_IS_TYPE (psk -> __origin__ , tp )) {
661
661
return PyUnicode_FromFormat ("%U.kwargs" ,
662
662
((paramspecobject * )psk -> __origin__ )-> name );
@@ -789,14 +789,14 @@ static PyMemberDef paramspec_members[] = {
789
789
static PyObject *
790
790
paramspec_args (PyObject * self , void * unused )
791
791
{
792
- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .paramspecargs_type ;
792
+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .paramspecargs_type ;
793
793
return (PyObject * )paramspecattr_new (tp , self );
794
794
}
795
795
796
796
static PyObject *
797
797
paramspec_kwargs (PyObject * self , void * unused )
798
798
{
799
- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .paramspeckwargs_type ;
799
+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .paramspeckwargs_type ;
800
800
return (PyObject * )paramspecattr_new (tp , self );
801
801
}
802
802
@@ -810,7 +810,7 @@ static paramspecobject *
810
810
paramspec_alloc (PyObject * name , PyObject * bound , bool covariant ,
811
811
bool contravariant , bool infer_variance , PyObject * module )
812
812
{
813
- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .paramspec_type ;
813
+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .paramspec_type ;
814
814
paramspecobject * ps = PyObject_GC_New (paramspecobject , tp );
815
815
if (ps == NULL ) {
816
816
return NULL ;
@@ -1059,7 +1059,7 @@ static PyMemberDef typevartuple_members[] = {
1059
1059
static typevartupleobject *
1060
1060
typevartuple_alloc (PyObject * name , PyObject * module )
1061
1061
{
1062
- PyTypeObject * tp = PyInterpreterState_Get ()-> cached_objects .typevartuple_type ;
1062
+ PyTypeObject * tp = _PyInterpreterState_GET ()-> cached_objects .typevartuple_type ;
1063
1063
typevartupleobject * tvt = PyObject_GC_New (typevartupleobject , tp );
1064
1064
if (tvt == NULL ) {
1065
1065
return NULL ;
@@ -1598,7 +1598,7 @@ _Py_subscript_generic(PyThreadState* unused, PyObject *params)
1598
1598
{
1599
1599
params = unpack_typevartuples (params );
1600
1600
1601
- PyInterpreterState * interp = PyInterpreterState_Get ();
1601
+ PyInterpreterState * interp = _PyInterpreterState_GET ();
1602
1602
if (interp -> cached_objects .generic_type == NULL ) {
1603
1603
PyErr_SetString (PyExc_SystemError , "Cannot find Generic type" );
1604
1604
return NULL ;
0 commit comments