py/objgenerator: Fix handling of None passed as 2nd arg to throw().
Fixes issue #4527.
This commit is contained in:
@@ -28,8 +28,8 @@ except StopIteration:
|
||||
def gen():
|
||||
try:
|
||||
yield 123
|
||||
except GeneratorExit:
|
||||
print('GeneratorExit')
|
||||
except GeneratorExit as e:
|
||||
print('GeneratorExit', repr(e.args))
|
||||
yield 456
|
||||
|
||||
# thrown a class
|
||||
@@ -41,3 +41,13 @@ print(g.throw(GeneratorExit))
|
||||
g = gen()
|
||||
print(next(g))
|
||||
print(g.throw(GeneratorExit()))
|
||||
|
||||
# thrown an instance with None as second arg
|
||||
g = gen()
|
||||
print(next(g))
|
||||
print(g.throw(GeneratorExit(), None))
|
||||
|
||||
# thrown a class and instance
|
||||
g = gen()
|
||||
print(next(g))
|
||||
print(g.throw(GeneratorExit, GeneratorExit(123)))
|
||||
|
||||
Reference in New Issue
Block a user