changeset 6228:f40c6b5de370

Fix reverse multilink iteration Adding a reverse multilink to *the same class* would trigger a traceback about a modified dictionary on iteration
author Ralf Schlatterbeck <rsc@runtux.com>
date Wed, 15 Jul 2020 13:28:58 +0200
parents 5105df69145d
children 175c5064476e
files CHANGES.txt roundup/hyperdb.py
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Mon Jul 13 01:13:00 2020 -0400
+++ b/CHANGES.txt	Wed Jul 15 13:28:58 2020 +0200
@@ -11,6 +11,12 @@
 v2.7.2 or later are required to run newer releases of Roundup.  From v2.0
 onwards Python 3.4 and later are also supported.
 
+XXXX-XX-XX 2.0.1
+
+Fixed:
+- Reverse multilink to *the same class* would trigger a traceback about
+  a modified dictionary on iteration (Ralf Schlatterbeck)
+
 2020-07-13 2.0.0
 
 Fixed:
--- a/roundup/hyperdb.py	Mon Jul 13 01:13:00 2020 -0400
+++ b/roundup/hyperdb.py	Wed Jul 15 13:28:58 2020 +0200
@@ -875,7 +875,9 @@
         done = getattr(self, 'post_init_done', None)
         for cn in self.getclasses():
             cl = self.getclass(cn)
-            for p in cl.properties:
+            # This will change properties if a back-multilink happens to
+            # have the same class, so we need to iterate over .keys()
+            for p in cl.properties.keys():
                 prop = cl.properties[p]
                 if not isinstance (prop, (Link, Multilink)):
                     continue

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