Skip to content

Do not call destructor if Marine was not initialized properly#37

Merged
yehonatanz merged 3 commits intomasterfrom
bugfix/marine-destructor-on-failed-init
Jul 13, 2020
Merged

Do not call destructor if Marine was not initialized properly#37
yehonatanz merged 3 commits intomasterfrom
bugfix/marine-destructor-on-failed-init

Conversation

@domerd
Copy link
Copy Markdown
Collaborator

@domerd domerd commented Jul 13, 2020

Closes issue #18

Copy link
Copy Markdown
Collaborator

@yehonatanz yehonatanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you ran black on the code?

marine/marine.py Outdated

def __del__(self):
self._marine.destroy_marine()
if hasattr(self, '_marine') and self._marine:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simply:

if getattr(self, "_marine"):
    ...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed + Ran Black

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops I meant:

if getattr(self, "_marine", None):
    ...

@yehonatanz yehonatanz merged commit 222b27a into master Jul 13, 2020
@tomlegkov tomlegkov deleted the bugfix/marine-destructor-on-failed-init branch February 5, 2021 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't call Marine destructor when Marine wasn't initialized properly

3 participants