Skip to content

Commit

Permalink
Fix crash on python exit; globals can be None in this case
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslb committed Nov 25, 2019
1 parent 5b8a64f commit a6732b2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions psiesta/psiesta.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,10 @@ def read_density_matrices(self):
return DM, EDM

def __del__(self):
# TODO: chdir may have been set to None if python is shutting down, handle it better
if chdir is None:
self.launched = False # dont call fsiesta quit
super().__del__()
return
with chdir(self.working_dir):
super().__del__()

0 comments on commit a6732b2

Please sign in to comment.