forked from VimPlug/jedi
__slots__ usage works much better now -> scan for all slots and not only for current class
This commit is contained in:
@@ -159,13 +159,15 @@ def fast_parent_copy(obj):
|
|||||||
# __dict__ not available, because of __slots__
|
# __dict__ not available, because of __slots__
|
||||||
items = []
|
items = []
|
||||||
|
|
||||||
|
before = ()
|
||||||
|
for cls in new_obj.__class__.__mro__:
|
||||||
try:
|
try:
|
||||||
names = new_obj.__slots__
|
if before == cls.__slots__:
|
||||||
|
continue
|
||||||
|
before = cls.__slots__
|
||||||
|
items += [(n, getattr(new_obj, n)) for n in before]
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# __slots__ not available (normal)
|
|
||||||
pass
|
pass
|
||||||
else:
|
|
||||||
items += [(n, getattr(new_obj, n)) for n in names]
|
|
||||||
|
|
||||||
for key, value in items:
|
for key, value in items:
|
||||||
# replace parent (first try _parent and then parent)
|
# replace parent (first try _parent and then parent)
|
||||||
|
|||||||
Reference in New Issue
Block a user