Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c620a61

Browse files
committed
Use PyModule_AddObjectRef
1 parent 7a6dea1 commit c620a61

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Modules/_queuemodule.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -385,17 +385,15 @@ static int
385385
queuemodule_exec(PyObject *module)
386386
{
387387
simplequeue_state *state = simplequeue_get_state(module);
388+
388389
state->EmptyError = PyErr_NewExceptionWithDoc(
389390
"_queue.Empty",
390391
"Exception raised by Queue.get(block=0)/get_nowait().",
391392
NULL, NULL);
392393
if (state->EmptyError == NULL) {
393394
return -1;
394395
}
395-
396-
Py_INCREF(state->EmptyError);
397-
if (PyModule_AddObject(module, "Empty", state->EmptyError) < 0) {
398-
Py_CLEAR(state->EmptyError);
396+
if (PyModule_AddObjectRef(module, "Empty", state->EmptyError) < 0) {
399397
return -1;
400398
}
401399

0 commit comments

Comments
 (0)