mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Merged revisions 78766 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r78766 | benjamin.peterson | 2010-03-07 11:10:51 -0600 (Sun, 07 Mar 2010) | 1 line prevent generator finalization from invalidating sys.exc_info() #7173 ........
This commit is contained in:
parent
056c060589
commit
d01444d325
3 changed files with 19 additions and 2 deletions
|
@ -6,7 +6,8 @@ import unittest
|
|||
import pickle
|
||||
import weakref
|
||||
|
||||
from test.support import TESTFN, unlink, run_unittest, captured_output
|
||||
from test.support import (TESTFN, unlink, run_unittest, captured_output,
|
||||
gc_collect)
|
||||
|
||||
# XXX This is not really enough, each *operation* should be tested!
|
||||
|
||||
|
@ -554,6 +555,20 @@ class ExceptionTests(unittest.TestCase):
|
|||
del g
|
||||
self.assertEquals(sys.exc_info()[0], TypeError)
|
||||
|
||||
def test_generator_finalizing_and_exc_info(self):
|
||||
# See #7173
|
||||
def simple_gen():
|
||||
yield 1
|
||||
def run_gen():
|
||||
gen = simple_gen()
|
||||
try:
|
||||
raise RuntimeError
|
||||
except RuntimeError:
|
||||
return next(gen)
|
||||
run_gen()
|
||||
gc_collect()
|
||||
self.assertEqual(sys.exc_info(), (None, None, None))
|
||||
|
||||
def test_3114(self):
|
||||
# Bug #3114: in its destructor, MyObject retrieves a pointer to
|
||||
# obsolete and/or deallocated objects.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue