Skip to content

Commit 11c6888

Browse files
authored
Don't free too much before doing fast_exit (#8552)
1 parent afe0667 commit 11c6888

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎mypy/main.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def flush_errors(new_messages: List[str], serious: bool) -> None:
106106
if MEM_PROFILE:
107107
from mypy.memprofile import print_memory_profile
108108
print_memory_profile()
109-
del res # Now it's safe to delete
110109

111110
code = 0
112111
if messages:
@@ -129,6 +128,9 @@ def flush_errors(new_messages: List[str], serious: bool) -> None:
129128
elif code:
130129
sys.exit(code)
131130

131+
# HACK: keep res alive so that mypyc won't free it before the hard_exit
132+
list([res])
133+
132134

133135
# Make the help output a little less jarring.
134136
class AugmentedHelpFormatter(argparse.RawDescriptionHelpFormatter):

0 commit comments

Comments
 (0)