@@ -838,8 +838,7 @@ sys_exit_impl(PyObject *module, PyObject *status)
838
838
/*[clinic end generated code: output=13870986c1ab2ec0 input=b86ca9497baa94f2]*/
839
839
{
840
840
/* Raise SystemExit so callers may catch it or clean up. */
841
- PyThreadState * tstate = _PyThreadState_GET ();
842
- _PyErr_SetObject (tstate , PyExc_SystemExit , status );
841
+ PyErr_SetObject (PyExc_SystemExit , status );
843
842
return NULL ;
844
843
}
845
844
@@ -905,15 +904,14 @@ static PyObject *
905
904
sys_intern_impl (PyObject * module , PyObject * s )
906
905
/*[clinic end generated code: output=be680c24f5c9e5d6 input=849483c006924e2f]*/
907
906
{
908
- PyThreadState * tstate = _PyThreadState_GET ();
909
907
if (PyUnicode_CheckExact (s )) {
910
908
Py_INCREF (s );
911
909
PyUnicode_InternInPlace (& s );
912
910
return s ;
913
911
}
914
912
else {
915
- _PyErr_Format ( tstate , PyExc_TypeError ,
916
- "can't intern %.400s" , Py_TYPE (s )-> tp_name );
913
+ PyErr_Format ( PyExc_TypeError ,
914
+ "can't intern %.400s" , Py_TYPE (s )-> tp_name );
917
915
return NULL ;
918
916
}
919
917
}
@@ -1141,10 +1139,9 @@ static PyObject *
1141
1139
sys_setswitchinterval_impl (PyObject * module , double interval )
1142
1140
/*[clinic end generated code: output=65a19629e5153983 input=561b477134df91d9]*/
1143
1141
{
1144
- PyThreadState * tstate = _PyThreadState_GET ();
1145
1142
if (interval <= 0.0 ) {
1146
- _PyErr_SetString ( tstate , PyExc_ValueError ,
1147
- "switch interval must be strictly positive" );
1143
+ PyErr_SetString ( PyExc_ValueError ,
1144
+ "switch interval must be strictly positive" );
1148
1145
return NULL ;
1149
1146
}
1150
1147
_PyEval_SetSwitchInterval ((unsigned long ) (1e6 * interval ));
@@ -1277,7 +1274,6 @@ sys_set_asyncgen_hooks(PyObject *self, PyObject *args, PyObject *kw)
1277
1274
static char * keywords [] = {"firstiter" , "finalizer" , NULL };
1278
1275
PyObject * firstiter = NULL ;
1279
1276
PyObject * finalizer = NULL ;
1280
- PyThreadState * tstate = _PyThreadState_GET ();
1281
1277
1282
1278
if (!PyArg_ParseTupleAndKeywords (
1283
1279
args , kw , "|OO" , keywords ,
@@ -1287,9 +1283,9 @@ sys_set_asyncgen_hooks(PyObject *self, PyObject *args, PyObject *kw)
1287
1283
1288
1284
if (finalizer && finalizer != Py_None ) {
1289
1285
if (!PyCallable_Check (finalizer )) {
1290
- _PyErr_Format ( tstate , PyExc_TypeError ,
1291
- "callable finalizer expected, got %.50s" ,
1292
- Py_TYPE (finalizer )-> tp_name );
1286
+ PyErr_Format ( PyExc_TypeError ,
1287
+ "callable finalizer expected, got %.50s" ,
1288
+ Py_TYPE (finalizer )-> tp_name );
1293
1289
return NULL ;
1294
1290
}
1295
1291
if (_PyEval_SetAsyncGenFinalizer (finalizer ) < 0 ) {
@@ -1302,9 +1298,9 @@ sys_set_asyncgen_hooks(PyObject *self, PyObject *args, PyObject *kw)
1302
1298
1303
1299
if (firstiter && firstiter != Py_None ) {
1304
1300
if (!PyCallable_Check (firstiter )) {
1305
- _PyErr_Format ( tstate , PyExc_TypeError ,
1306
- "callable firstiter expected, got %.50s" ,
1307
- Py_TYPE (firstiter )-> tp_name );
1301
+ PyErr_Format ( PyExc_TypeError ,
1302
+ "callable firstiter expected, got %.50s" ,
1303
+ Py_TYPE (firstiter )-> tp_name );
1308
1304
return NULL ;
1309
1305
}
1310
1306
if (_PyEval_SetAsyncGenFirstiter (firstiter ) < 0 ) {
@@ -1505,7 +1501,6 @@ sys_getwindowsversion_impl(PyObject *module)
1505
1501
wchar_t kernel32_path [MAX_PATH ];
1506
1502
LPVOID verblock ;
1507
1503
DWORD verblock_size ;
1508
- PyThreadState * tstate = _PyThreadState_GET ();
1509
1504
1510
1505
ver .dwOSVersionInfoSize = sizeof (ver );
1511
1506
if (!GetVersionExW ((OSVERSIONINFOW * ) & ver ))
@@ -1556,11 +1551,10 @@ sys_getwindowsversion_impl(PyObject *module)
1556
1551
realBuild
1557
1552
));
1558
1553
1559
- if (_PyErr_Occurred ( tstate )) {
1554
+ if (PyErr_Occurred ( )) {
1560
1555
Py_DECREF (version );
1561
1556
return NULL ;
1562
1557
}
1563
-
1564
1558
return version ;
1565
1559
}
1566
1560
0 commit comments