Parcourir la source

Close the model at the end, to make sure that types are flushed

Yentl Van Tendeloo il y a 8 ans
Parent
commit
1b44df21f8
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  1. 6 0
      wrappers/modelverse.py

+ 6 - 0
wrappers/modelverse.py

@@ -1014,3 +1014,9 @@ def model_types(model_name):
     _input(["model_types", model_name])
     output = _handle_output("Success: ", split=True)
     return set(output)
+
+import atexit
+def _close_model():
+    if mode == MODE_MODIFY:
+        _model_exit()
+atexit.register(_close_model)