4 ms·
I used ctypes to change the base class of Python's GeneratorExit from Exception to BaseException because the official patch didn't make it in until 2.6. import
by chadaustin 17y ago
I used ctypes to change the base class of Python's GeneratorExit from Exception to BaseException because the official patch didn't make it in until 2.6.
import __builtin__, ctypes
class ImvuGeneratorExit(BaseException):
pass
__builtins__['GeneratorExit'] = ImvuGeneratorExit
__builtin__.GeneratorExit = ImvuGeneratorExit
ctypes.c_void_p.in_dll(ctypes.pythonapi, 'PyExc_GeneratorExit').value = id(ImvuGeneratorExit)