Chris Jerdonek added the comment: Good suggestion, David. Here is such sample test code. It is adapted from the sample code for "ValueError: generator already executing" included in PEP 255:
def test_gen(call_gen_method): def gen(): call_gen_method(me) yield 1 me = gen() try: me.__next__() except Exception as e: print(repr(e)) test_gen(lambda g: g.__next__()) test_gen(lambda g: g.send(1)) test_gen(lambda g: g.throw(OSError)) test_gen(lambda g: g.close()) This outputs: ValueError('generator already executing',) ValueError('generator already executing',) ValueError('generator already executing',) ValueError('generator already executing',) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15355> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com