summaryrefslogtreecommitdiffstats
path: root/Lib/contextlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/contextlib.py')
-rw-r--r--Lib/contextlib.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/contextlib.py b/Lib/contextlib.py
index 4f83ef6..dbd1c57 100644
--- a/Lib/contextlib.py
+++ b/Lib/contextlib.py
@@ -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()")