Fix error in atexit._run_exitfuncs, 2nd trial + make doctest of py_validation more robust