comparison roundup/hyperdb.py @ 6516:3e6c2039d0a8

Fix dict being changed during iteration .. for python3: simply using .keys() is not enough.
author Ralf Schlatterbeck <rsc@runtux.com>
date Thu, 21 Oct 2021 13:07:33 +0200
parents 8e06194ff0b0
children 6f35be77324c
comparison
equal deleted inserted replaced
6515:df4f955544aa 6516:3e6c2039d0a8
952 """ 952 """
953 done = getattr(self, 'post_init_done', None) 953 done = getattr(self, 'post_init_done', None)
954 for cn in self.getclasses(): 954 for cn in self.getclasses():
955 cl = self.getclass(cn) 955 cl = self.getclass(cn)
956 # This will change properties if a back-multilink happens to 956 # This will change properties if a back-multilink happens to
957 # have the same class, so we need to iterate over .keys() 957 # have the same class, so we need to iterate over a list made
958 for p in cl.properties.keys(): 958 # from .keys()
959 for p in list(cl.properties.keys()):
959 prop = cl.properties[p] 960 prop = cl.properties[p]
960 if not isinstance (prop, (Link, Multilink)): 961 if not isinstance (prop, (Link, Multilink)):
961 continue 962 continue
962 if prop.rev_multilink: 963 if prop.rev_multilink:
963 linkcls = self.getclass(prop.classname) 964 linkcls = self.getclass(prop.classname)

Roundup Issue Tracker: http://roundup-tracker.org/