summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-08-10 23:34:14 (GMT)
committerGitHub <noreply@github.com>2021-08-10 23:34:14 (GMT)
commitbfc2d5a5c4550ab3a2fadeb9459b4bd948ff61a2 (patch)
tree36d1b5928bc184fe779ba78e08f27ca01b36afaa /Lib/test/test_exceptions.py
parentc0ab59f7de1906feee21c057ad433fad924d1e38 (diff)
downloadcpython-bfc2d5a5c4550ab3a2fadeb9459b4bd948ff61a2.zip
cpython-bfc2d5a5c4550ab3a2fadeb9459b4bd948ff61a2.tar.gz
cpython-bfc2d5a5c4550ab3a2fadeb9459b4bd948ff61a2.tar.bz2
bpo-33930: Fix segfault with deep recursion when cleaning method objects (GH-27678)
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 593107f..8bcb4b0 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -1169,6 +1169,21 @@ class ExceptionTests(unittest.TestCase):
self.assertIsInstance(v, RecursionError, type(v))
self.assertIn("maximum recursion depth exceeded", str(v))
+
+ @cpython_only
+ def test_crashcan_recursion(self):
+ # See bpo-33930
+
+ def foo():
+ o = object()
+ for x in range(1_000_000):
+ # Create a big chain of method objects that will trigger
+ # a deep chain of calls when they need to be destructed.
+ o = o.__dir__
+
+ foo()
+ support.gc_collect()
+
@cpython_only
def test_recursion_normalizing_exception(self):
# Issue #22898.