Hi, I've rewritten Cython's dict iteration code to use normal PyIter_Next() iteration on PyPy, but now I get a crash in one of the tests. Apparently, the iterator fails to raise an exception when the dict is being resized during iteration. The test goes like this:
''' def iterdict_change_size(dict d): """ >>> count, i = 0, -1 >>> d = {1:2, 10:20} >>> for i in d: ... d[i+1] = 5 ... count += 1 ... if count > 5: ... break # safety Traceback (most recent call last): RuntimeError: dictionary changed size during iteration >>> iterdict_change_size({1:2, 10:20}) Traceback (most recent call last): RuntimeError: dictionary changed size during iteration >>> print( iterdict_change_size({}) ) DONE """ cdef int count = 0 i = -1 for i in d: d[i+1] = 5 count += 1 if count > 5: break # safety return "DONE" ''' It's supposed to raise an exception when starting the second iteration, but in PyPy, it crashes at that point instead. Stefan _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev