You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
<unittest> AssertRaises() causes core dump in handling recursion #87351
Seeing the following program, in the second assertRaises(), function "test_invalid_adpcm_state()" is recursively called. Then a fatal Python error shows up and the Python interpreter crashes.
3.9 crashes.
On master, I'm not seeing a crash, just a RecursionError.
>>> import unittest
>>>
>>> deff():
... raiseTypeError
...
>>> classTestAudioop(unittest.TestCase):
... deftest_invalid_adpcm_state(self):
... self.assertRaises(TypeError, f)
... self.test_invalid_adpcm_state()
...
>>> TestAudioop().test_invalid_adpcm_state()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 4, in test_invalid_adpcm_state
File "<stdin>", line 4, in test_invalid_adpcm_state
File "<stdin>", line 4, in test_invalid_adpcm_state
[Previous line repeated 992 more times]
File "<stdin>", line 3, in test_invalid_adpcm_state
File "/home/mark/repos/cpython/Lib/unittest/case.py", line 730, in assertRaises
context = _AssertRaisesContext(expected_exception, self)
File "/home/mark/repos/cpython/Lib/unittest/case.py", line 168, in __init__
_BaseTestCaseContext.__init__(self, test_case)
RecursionError: maximum recursion depth exceeded
bpo-43186, bpo-43187 also have recursive code that fails in 3.9 and recovers in 3.10. Am closing them in favor of this. Also suspect bpo-43188, bpo-43189, bpo-43190 are duplicates. Yang, recheck after Mark does the backport here.
Activity
CharlesFengY commentedon Feb 10, 2021
Seeing the following program, in the second assertRaises(), function "test_invalid_adpcm_state()" is recursively called. Then a fatal Python error shows up and the Python interpreter crashes.
++++++++++++++++++++++++++++++++++++++
import unittest
import audioop
+++++++++++++++++++++++++++++++++++++++
System Info: Ubuntu 16.04
Python Version: Python 3.9.1
iritkatriel commentedon Feb 10, 2021
Reproduced on master as well. Simplified script:
------------------------------------------
TestAudioop().test_invalid_adpcm_state()
------------------------------------------
CharlesFengY commentedon Feb 10, 2021
Could you please tell me your secret method of getting the minimal script?
I will try to provide minimal ones in our following work.
markshannon commentedon Feb 10, 2021
3.9 crashes.
On master, I'm not seeing a crash, just a RecursionError.
iritkatriel commentedon Feb 10, 2021
Yang - no secret really, just trial and error.
Mark - right I wasn't on master, sorry.
markshannon commentedon Feb 10, 2021
I think this was fixed by #23568
The root cause seems to be the same as bpo-42500, so I'm going to backport #23568 to 3.9
terryjreedy commentedon Feb 13, 2021
bpo-43186, bpo-43187 also have recursive code that fails in 3.9 and recovers in 3.10. Am closing them in favor of this. Also suspect bpo-43188, bpo-43189, bpo-43190 are duplicates. Yang, recheck after Mark does the backport here.