Author: Ronan Lamy <ronan.l...@gmail.com> Branch: union-side-effects Changeset: r86851:81eb595adb63 Date: 2016-09-03 01:44 +0100 http://bitbucket.org/pypy/pypy/changeset/81eb595adb63/
Log: Fix union() and give a correct explanation for the s1==s2 case diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -745,6 +745,10 @@ except AttributeError: TLS.no_side_effects_in_union = 1 try: + if s1 == s2: + # Most pair(...).union() methods deal incorrectly with that case + # when constants are involved. + return s1 return pair(s1, s2).union() finally: TLS.no_side_effects_in_union -= 1 @@ -759,8 +763,7 @@ if s1 != s2: s1 = pair(s1, s2).union() else: - # this is just a performance shortcut - # XXX: This is a lie! Grep for no_side_effects_in_union and weep. + # See comment in union() above if s1 != s2: s1 = pair(s1, s2).union() return s1 _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit