bpo-30570: Fix segfault on buildbots caused by stack overflow from recursion in tests (GH-29258)

* Don't stackoveflow on debug builds

* Also catch the pickletester case
This commit is contained in:
Dennis Sweeney 2021-10-28 06:11:18 -04:00 committed by GitHub
parent 4c95fb4640
commit d56375a0dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 12 deletions

View file

@ -2383,7 +2383,8 @@ class AbstractPickleTests:
# Issue #3514: crash when there is an infinite loop in __getattr__
x = BadGetattr()
for proto in protocols:
self.assertRaises(RuntimeError, self.dumps, x, proto)
with support.infinite_recursion():
self.assertRaises(RuntimeError, self.dumps, x, proto)
def test_reduce_bad_iterator(self):
# Issue4176: crash when 4th and 5th items of __reduce__()