models: Fix review comments
This commit is contained in:
parent
777a663896
commit
20019edf2d
@ -150,9 +150,8 @@ class ImmutableObjectMeta(type):
|
||||
attrs['_instances'] = weakref.WeakValueDictionary()
|
||||
attrs['__slots__'] = ['_hash'] + fields.values()
|
||||
|
||||
anncestors = [b for base in bases for b in inspect.getmro(base)]
|
||||
for anncestor in anncestors:
|
||||
if '__weakref__' in getattr(anncestor, '__slots__', []):
|
||||
for ancestor in [b for base in bases for b in inspect.getmro(base)]:
|
||||
if '__weakref__' in getattr(ancestor, '__slots__', []):
|
||||
break
|
||||
else:
|
||||
attrs['__slots__'].append('__weakref__')
|
||||
|
||||
@ -8,7 +8,7 @@ from mopidy.models import (
|
||||
TlTrack, Track, model_json_decoder)
|
||||
|
||||
|
||||
class InheritanecTest(unittest.TestCase):
|
||||
class InheritanceTest(unittest.TestCase):
|
||||
|
||||
def test_weakref_and_slots_play_nice_in_subclass(self):
|
||||
# Check that the following does not happen:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user