
4 Sep
2001
4 Sep
'01
11:28 a.m.
Here's a simple test:
from __future__ import generators def test(): yield 1 yield 2 import profile profile.run("list(test())")
It looks like the profile module is getting confused by functions that get called once but return multiple times. My proposed solution is to modify ceval.c so that call_trace(..., PyTrace_CALL, ...) is called when a generator is resumed rather then when it is created. Sound reasonable?
Yes. (Caveat: I haven't looked at the code.)
--Guido van Rossum (home page: http://www.python.org/~guido/)