# generator ignores a thrown GeneratorExit (this is allowed)defgen():try:yield123exceptGeneratorExit:print('GeneratorExit')yield456# thrown a classg=gen()print(next(g))print(g.throw(GeneratorExit))# thrown an instanceg=gen()print(next(g))print(g.throw(GeneratorExit()))