File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -3475,10 +3475,11 @@ static PyObject *
34753475tracemalloc_track_race (PyObject * self , PyObject * args )
34763476{
34773477#define NTHREAD 50
3478+ PyObject * tracemalloc = NULL ;
34783479 PyObject * stop = NULL ;
34793480 tracemalloc_track_race_data data = {0 };
34803481
3481- PyObject * tracemalloc = PyImport_ImportModule ("tracemalloc" );
3482+ tracemalloc = PyImport_ImportModule ("tracemalloc" );
34823483 if (tracemalloc == NULL ) {
34833484 goto error ;
34843485 }
@@ -3494,7 +3495,7 @@ tracemalloc_track_race(PyObject *self, PyObject *args)
34943495 }
34953496
34963497 stop = PyObject_GetAttrString (tracemalloc , "stop" );
3497- Py_DECREF (tracemalloc );
3498+ Py_CLEAR (tracemalloc );
34983499 if (stop == NULL ) {
34993500 goto error ;
35003501 }
@@ -3536,6 +3537,7 @@ tracemalloc_track_race(PyObject *self, PyObject *args)
35363537 Py_RETURN_NONE ;
35373538
35383539error :
3540+ Py_CLEAR (tracemalloc );
35393541 Py_CLEAR (stop );
35403542 if (data .lock ) {
35413543 PyThread_free_lock (data .lock );
You can’t perform that action at this time.
0 commit comments