summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-08-29 12:47:44 (GMT)
committerGitHub <noreply@github.com>2017-08-29 12:47:44 (GMT)
commit265fcc5fc25d65afb33fda480c603f1e974e374e (patch)
tree7bb91548c80be5ddf5119624bf6acee6d672ed6c /Lib
parentba7d7365215d791025d1efd25393c91404f2cfc8 (diff)
downloadcpython-265fcc5fc25d65afb33fda480c603f1e974e374e.zip
cpython-265fcc5fc25d65afb33fda480c603f1e974e374e.tar.gz
cpython-265fcc5fc25d65afb33fda480c603f1e974e374e.tar.bz2
bpo-31286, bpo-30024: Fixed stack usage in absolute imports with (#3217)
binding a submodule to a name.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_import/__init__.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py
index 1b04de2..ddef27d 100644
--- a/Lib/test/test_import/__init__.py
+++ b/Lib/test/test_import/__init__.py
@@ -237,6 +237,23 @@ class ImportTests(unittest.TestCase):
import test.support as y
self.assertIs(y, test.support, y.__name__)
+ def test_issue31286(self):
+ # import in a 'finally' block resulted in SystemError
+ try:
+ x = ...
+ finally:
+ import test.support.script_helper as x
+
+ # import in a 'while' loop resulted in stack overflow
+ i = 0
+ while i < 10:
+ import test.support.script_helper as x
+ i += 1
+
+ # import in a 'for' loop resulted in segmentation fault
+ for i in range(2):
+ import test.support.script_helper as x
+
def test_failing_reload(self):
# A failing reload should leave the module object in sys.modules.
source = TESTFN + os.extsep + "py"