summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-12-15 01:36:03 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-12-15 01:36:03 (GMT)
commit64a1e7cab1fe8f0b0b42b93bbd40e73fc983c138 (patch)
tree26ea48b3229827183f286e8121d45e51ec627be0 /Lib
parent66ea7c32d21a5c8616a9fb79bfbe100af9bcb6a6 (diff)
downloadcpython-64a1e7cab1fe8f0b0b42b93bbd40e73fc983c138.zip
cpython-64a1e7cab1fe8f0b0b42b93bbd40e73fc983c138.tar.gz
cpython-64a1e7cab1fe8f0b0b42b93bbd40e73fc983c138.tar.bz2
Merged revisions 87251 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r87251 | r.david.murray | 2010-12-14 18:06:25 -0500 (Tue, 14 Dec 2010) | 4 lines #4236: avoid possible Fatal Error when import is called from __del__ Patch by Simon Cross, crasher test code by Martin von Löwis. ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_import.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
index cd8b4a4..5751901 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -8,7 +8,8 @@ import sys
import unittest
from test.test_support import (unlink, TESTFN, unload, run_unittest, rmtree,
is_jython, check_warnings, EnvironmentVarGuard)
-
+import textwrap
+from test import script_helper
def remove_files(name):
for f in (name + os.extsep + "py",
@@ -253,6 +254,17 @@ class ImportTests(unittest.TestCase):
self.assertEqual("Import by filename is not supported.",
c.exception.args[0])
+ def test_import_in_del_does_not_crash(self):
+ # Issue 4236
+ testfn = script_helper.make_script('', TESTFN, textwrap.dedent("""\
+ import sys
+ class C:
+ def __del__(self):
+ import imp
+ sys.argv.insert(0, C())
+ """))
+ script_helper.assert_python_ok(testfn)
+
class PycRewritingTests(unittest.TestCase):
# Test that the `co_filename` attribute on code objects always points