mirror of
https://github.com/python/cpython.git
synced 2025-08-01 23:53:15 +00:00
Fix for bug 1705170 - contextmanager swallowing StopIteration (2.5 backport candidate)
This commit is contained in:
parent
ac3d429edc
commit
3814a911aa
2 changed files with 21 additions and 0 deletions
|
@ -25,6 +25,10 @@ class GeneratorContextManager(object):
|
|||
else:
|
||||
raise RuntimeError("generator didn't stop")
|
||||
else:
|
||||
if value is None:
|
||||
# Need to force instantiation so we can reliably
|
||||
# tell if we get the same exception back
|
||||
value = type()
|
||||
try:
|
||||
self.gen.throw(type, value, traceback)
|
||||
raise RuntimeError("generator didn't stop after throw()")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue