Skip to content

Commit ff3d717

Browse files
committed
Change Py_XDECREF to Py_CLEAR
Use Py_CLEAR instead of using Py_XDECREF on the module object we created and then setting it to NULL because Py_CLEAR does the same thing.
1 parent 24f5ce3 commit ff3d717

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mypyc/codegen/emitmodule.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,14 +921,13 @@ def generate_module_def(self, emitter: Emitter, module_name: str, module: Module
921921

922922
emitter.emit_line('return {};'.format(module_static))
923923
emitter.emit_lines('fail:',
924-
'Py_XDECREF({});'.format(module_static),
924+
'Py_CLEAR({});'.format(module_static),
925925
'Py_XDECREF(modname);')
926926
# the type objects returned from CPyType_FromTemplate are all new references
927927
# so we have to decref them
928928
for t in type_structs:
929929
emitter.emit_line('Py_XDECREF({});'.format(t))
930-
emitter.emit_lines('{} = NULL;'.format(module_static),
931-
'return NULL;')
930+
emitter.emit_line('return NULL;')
932931
emitter.emit_line('}')
933932

934933
def generate_top_level_call(self, module: ModuleIR, emitter: Emitter) -> None:

0 commit comments

Comments
 (0)