bpo-21302: Add nanosleep() implementation for time.sleep() in Unix by vstinner · Pull Request #28545 · python/cpython

The PR #28526 LGTM, but I propose to write the #ifdef dance differently and rename secs to timeout to make the code more readable. So I created this PR based on PR #28526. For the main code in Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS, I merged the 3 code paths to put if #ifdef in the Py_BEGIN_ALLOW_THREADS block.

@Livius90: Is it better? What do you think?