Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions mathics/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import argparse
import atexit
import cProfile
import gc
import sys
from typing import Optional

Expand Down Expand Up @@ -60,6 +61,14 @@ def main() -> int:
Return exit code we want to give status of
"""
exit_rc = 0

# Registered first, so it runs last among the atexit handlers.
# Freezing moves every tracked object into the permanent generation,
# so the collection in Py_Finalize() does not walk the large
# Generation 2 graph left by packages such as Rubi. Unlike os._exit(),
# the other atexit handlers, stream flushes and exit codes are kept.
atexit.register(gc.freeze)

argparser = argparse.ArgumentParser(
prog="mathics",
usage="%(prog)s [options] [FILE]",
Expand Down
Loading