Chris Jerdonek <chris.jerdo...@gmail.com> added the comment:
Okay, I was able to remove the NULL value check and get things working with a NULL exception value. I just posted a second follow-on PR that does this (which Guido approved - thanks, Guido!): https://github.com/python/cpython/pull/19877 I wanted to tell you what I found since it raises some questions. To remove that check I had to add the following new check prior to calling `_PyErr_ChainExceptions()` with the exception info, as a replacement: `gen->gi_exc_state.exc_type != Py_None` Without doing this, code like the following would crash e.g. on Fedora 32 (this is the crash that was happening in the first version of my PR, reduced down): def g(): try: raise KeyError except KeyError: pass try: yield except Exception: # Crash happens here e.g. on Fedora 32 but not Mac. raise RuntimeError gen = g() gen.send(None) gen.throw(ValueError) This raises two questions for me: First, I thought exc_type could only ever be NULL or an exception class. So I'm wondering if this points to a problem elsewhere in the code base. Second, I don't know why it would crash on Fedora but not Mac. (On Mac, you instead see the following exception chained beneath the ValueError: > TypeError: print_exception(): Exception expected for value, NoneType found ) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue29587> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com