[pypy-svn] r32784 - pypy/dist/pypy/objspace/flow

arigo at codespeak.net arigo at codespeak.net
Sun Oct 1 12:46:35 CEST 2006


Author: arigo
Date: Sun Oct  1 12:46:34 2006
New Revision: 32784

Modified:
   pypy/dist/pypy/objspace/flow/model.py
Log:
Fix of the fix ("default" ==> Constant("default")).

Although it's now theoretically possible to have an exitswitch Variable
with only one exit link whose exit case is None, we are not producing
such things so far.  It's more likely a bug, so let's crash.



Modified: pypy/dist/pypy/objspace/flow/model.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/model.py	(original)
+++ pypy/dist/pypy/objspace/flow/model.py	Sun Oct  1 12:46:34 2006
@@ -653,9 +653,12 @@
                     # branches are in the wrong order)
                     assert len(block.exits) >= 1
                     cases = [Constant(link.exitcase) for link in block.exits]
-                    if 'default' in cases:
-                        assert 'default' == cases[-1]
+                    if Constant('default') in cases:
+                        assert Constant('default') == cases[-1]
                     assert len(dict.fromkeys(cases)) == len(cases)
+                    assert cases != [Constant(None)], (
+                        "exitswitch Variable followed by a normal-looking link"
+                        " is probably not intended")
 
             allexitcases = {}
             for link in block.exits:



More information about the Pypy-commit mailing list