Skip to content

Commit 025423f

Browse files
committed
Fix segfault
1 parent 1f84e5c commit 025423f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mypyc/codegen/emitclass.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,9 @@ def generate_dealloc_for_class(
851851
# CPython interpreter prints: Exception ignored in: <function F.__del__ at 0x100aed940>
852852
# mypyc prints: Exception ignored in: <slot wrapper '__del__' of 'F' objects>
853853
emitter.emit_line("if (PyErr_Occurred() != NULL) {")
854+
# Don't untrack instance if error occurred
854855
emitter.emit_line("PyErr_WriteUnraisable((PyObject *)self);")
856+
emitter.emit_line("res = -1;")
855857
emitter.emit_line("}")
856858
emitter.emit_line("PyErr_Restore(type, value, traceback);")
857859
emitter.emit_line("if (res < 0) {")

0 commit comments

Comments
 (0)