[issue14432] Bug in generator if the generator in created in a C thread

STINNER Victor report at bugs.python.org
Wed Nov 13 23:47:29 CET 2013


STINNER Victor added the comment:

Updated patch for Python 3.4:

- remove PyFrameObject.f_tstate attribute: the thread state can be easily retrieved, it is known where it is needed (see the patch). There is one function which doesn't know the thread state: _PyEval_CallTracing(), but this function was already calling PyEval_GetFrame() which calls PyThreadState_GET() internally, so...

- add an unit test for this issue (generator created in a temporary C thread)

It's really hard to reproduce the crash. I tried with my old tarball and I failed. I also tried with my unit test and I failed. I'm pretty sure that the crash can only be reproduced when Python is compiled is release mode.

I reproduced the crash once with the unit test on an unpatched Python 3.4.


For Python 2.7 and 3.3, what do you think of applying generator.patch? It looks simple and obvious. I don't know the impact on performances, but it should be very low.

----------
nosy: +serhiy.storchaka
Added file: http://bugs.python.org/file32605/issue14432.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14432>
_______________________________________


More information about the Python-bugs-list mailing list