Skip to content

Commit f2900f4

Browse files
committed
MAINT: Use GetItemRef for stop
1 parent 9fc8d6a commit f2900f4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/watchdog_fsevents.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,8 @@ static PyObject *
807807
watchdog_stop(PyObject *self, PyObject *emitter_thread)
808808
{
809809
UNUSED(self);
810-
PyObject *value = PyDict_GetItem(thread_to_run_loop, emitter_thread);
810+
PyObject *value = NULL;
811+
PyDict_GetItemRef(thread_to_run_loop, emitter_thread, &value);
811812
if (G_IS_NULL(value)) {
812813
goto success;
813814
}
@@ -822,6 +823,7 @@ watchdog_stop(PyObject *self, PyObject *emitter_thread)
822823
}
823824

824825
success:
826+
Py_XDECREF(value);
825827
Py_INCREF(Py_None);
826828
return Py_None;
827829
}

0 commit comments

Comments
 (0)