mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-33930: Fix segfault with deep recursion when cleaning method objects (GH-27678) (GH-27719)
(cherry picked from commit bfc2d5a5c4
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
a6808c6378
commit
d6d2d54997
3 changed files with 22 additions and 1 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue