[pypy-dev] Annotating space status

Guido van Rossum guido at python.org
Tue Jul 1 13:54:45 CEST 2003


I'm hoping Armin has some time to look into this; I probably won't.

There's this test that doesn't work any more:

    def dont_test_assign_local_w_flow_control(self):
        # XXX This test doesn't work any more -- disabled for now
        code = """
def f(n):
    total = 0
    for i in range(n):
        total = total + 1
    return n
"""
        x = self.codetest(code, 'f', [self.space.wrap(3)])
        self.assertEquals(type(x), W_Integer)

It worked before, when range(n) was enough to befuddle the symbolic
interpretation, but now, when you enable it (remove the "dont_" from
the name) it raises "TypeError: no result at all?!?!"

This seems to be because the next() call implicit in the for loop
doesn't ever raise IndeterminateCondition, because it is iterating
over a constant list (the list [0, 1, 2] returned by range(3)).  But
somehome frame unification decides to unify states after the 2nd time
through the loop -- and the alternative branch (to the end of the
loop) is never taken, so there is never a return value.

What's wrong here???

--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Pypy-dev mailing list