Serhiy Storchaka <[email protected]> added the comment:
The proposed fix fixes a crash, but there is other bug in iterating shared
dicts.
class A:
def __init__(self, x, y):
if x: self.x = x
if y: self.y = y
a = A(1, 2)
print(list(iter(a.__dict__)))
print(list(reversed(a.__dict__)))
b = A(1, 0)
print(list(iter(b.__dict__)))
print(list(reversed(b.__dict__)))
With PR 16846 the last print outputs [] instead of expected ['x']. It crashes
without PR 16846, so this issue is not only about empty dicts.
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38525>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com