[pypy-commit] pypy string-NUL: In litsdef.merge(), perform checks before we start modifying the other

amauryfa noreply at buildbot.pypy.org
Sat Jan 28 21:10:48 CET 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: string-NUL
Changeset: r51937:aa595f8bbf18
Date: 2012-01-28 20:48 +0100
http://bitbucket.org/pypy/pypy/changeset/aa595f8bbf18/

Log:	In litsdef.merge(), perform checks before we start modifying the
	other read locations. This makes debugging much much easier.

diff --git a/pypy/annotation/listdef.py b/pypy/annotation/listdef.py
--- a/pypy/annotation/listdef.py
+++ b/pypy/annotation/listdef.py
@@ -86,18 +86,19 @@
             read_locations = self.read_locations.copy()
             other_read_locations = other.read_locations.copy()
             self.read_locations.update(other.read_locations)
-            self.patch()    # which should patch all refs to 'other'
             s_value = self.s_value
             s_other_value = other.s_value
             s_new_value = unionof(s_value, s_other_value)
+            if s_new_value != s_value:
+                if self.dont_change_any_more:
+                    raise TooLateForChange
             if isdegenerated(s_new_value):
                 if self.bookkeeper:
                     self.bookkeeper.ondegenerated(self, s_new_value)
                 elif other.bookkeeper:
                     other.bookkeeper.ondegenerated(other, s_new_value)
+            self.patch()    # which should patch all refs to 'other'
             if s_new_value != s_value:
-                if self.dont_change_any_more:
-                    raise TooLateForChange
                 self.s_value = s_new_value
                 # reflow from reading points
                 for position_key in read_locations:


More information about the pypy-commit mailing list