Skip to content

Commit

Permalink
Use PyModule_AddObjectRef
Browse files Browse the repository at this point in the history
  • Loading branch information
tiran committed Nov 19, 2020
1 parent 7a6dea1 commit c620a61
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Modules/_queuemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,17 +385,15 @@ static int
queuemodule_exec(PyObject *module)
{
simplequeue_state *state = simplequeue_get_state(module);

state->EmptyError = PyErr_NewExceptionWithDoc(
"_queue.Empty",
"Exception raised by Queue.get(block=0)/get_nowait().",
NULL, NULL);
if (state->EmptyError == NULL) {
return -1;
}

Py_INCREF(state->EmptyError);
if (PyModule_AddObject(module, "Empty", state->EmptyError) < 0) {
Py_CLEAR(state->EmptyError);
if (PyModule_AddObjectRef(module, "Empty", state->EmptyError) < 0) {
return -1;
}

Expand Down

0 comments on commit c620a61

Please sign in to comment.