Skip to content

Commit

Permalink
fix: move __not_jsonable *inside* the __init__
Browse files Browse the repository at this point in the history
Turns out, if you modify a variable defined outside the __init__,
every instances (and inherited classes) of that class will be impacted by it.
  • Loading branch information
Rafiot committed Aug 7, 2019
1 parent a3140f3 commit da6d7cb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pymisp/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,11 @@ def default(self, obj):

class AbstractMISP(MutableMapping):

__not_jsonable = []

def __init__(self, **kwargs):
"""Abstract class for all the MISP objects"""
super(AbstractMISP, self).__init__()
self.__edited = True # As we create a new object, we assume it is edited
self.__not_jsonable = []

if kwargs.get('force_timestamps') is not None:
# Ignore the edited objects and keep the timestamps.
Expand Down

0 comments on commit da6d7cb

Please sign in to comment.