Kirill Simonov  committed fbce026

Eliminated some reference cycles.

  • Participants
  • Parent commits a3d0f2e

Comments (0)

Files changed (2)

File src/htsql/tr/

     def __init__(self, domain, units, binding, equality_vector=None):
         assert isinstance(domain, Domain)
-        assert isinstance(units, listof(Unit))
+        assert isinstance(units, maybe(listof(Unit)))
         super(Code, self).__init__(binding, equality_vector)
         self.domain = domain
-        self.units = units
+        # Do not assign when implemented as a property.
+        if units is not None:
+            self.units = units
 class LiteralCode(Code):
         assert isinstance(flow, Flow)
         super(Unit, self).__init__(
-                    units=[self],
+                    units=None,
         self.flow = flow
+    @property
+    def units(self):
+        # Implemented as a property to avoid creating a cycle.
+        return [self]
     def singular(self, flow):
         Verifies if the unit is singular (well-defined) on the given flow.

File src/htsql/

     for element in elements:
+    # Break the cycle created by recursive nested function.
+    dfs = None
     return ordered