gh-103193: Fix refleaks in test_inspect and test_typing
#104320
Merged
test_inspect and test_typing
#104320