Be more careful when restoring original import function
@@ -1156,6 +1156,7 @@ class Executor:
return self._execute_prepared_user_code(statements, expression, global_vars)
finally:
del sys.meta_path[0]
+ if hasattr(self._vm, "_original_import"):
self._vm._restore_original_import()
def _execute_prepared_user_code(self, statements, expression, global_vars):
