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
(cherry picked from commit d56375a0dd4cee162081b173310298a3d32af293)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2 files changed