Skip to content

Commit 37eb2fe

Browse files
corrected change
1 parent 468c752 commit 37eb2fe

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Objects/exceptions.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include "osdefs.h" // SEP
1818
#include "clinic/exceptions.c.h"
19-
19+
#include "pycore_critical_section.h"
2020

2121
/*[clinic input]
2222
class BaseException "PyBaseExceptionObject *" "&PyExc_BaseException"
@@ -243,20 +243,19 @@ BaseException___setstate___impl(PyBaseExceptionObject *self, PyObject *state)
243243
return NULL;
244244
}
245245
PyCriticalSection cs;
246-
PyThreadState *tstate = _PyThreadState_GET();
247-
_PyCriticalSection_Begin(tstate, &cs, state);
246+
PyCriticalSection_Begin(&cs, state);
248247
while (PyDict_Next(state, &i, &d_key, &d_value)) {
249248
Py_INCREF(d_key);
250249
Py_INCREF(d_value);
251250
int res = PyObject_SetAttr((PyObject *)self, d_key, d_value);
252251
Py_DECREF(d_value);
253252
Py_DECREF(d_key);
254253
if (res < 0) {
255-
_PyCriticalSection_End(tstate, &cs);
254+
PyCriticalSection_End(&cs);
256255
return NULL;
257256
}
258257
}
259-
_PyCriticalSection_End(tstate, &cs);
258+
PyCriticalSection_End(&cs);
260259
}
261260
Py_RETURN_NONE;
262261
}

0 commit comments

Comments
 (0)