<!-- If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not the right place to seek help. Consider the following options instead: - reading the Python tutorial: https://docs.python.org/3/tutorial/ - posting in the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7 - emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list - searching our issue tracker (https://github.com/python/cpython/issues) to see if your problem has already been reported --> ``` >>> os.dup2(-1, 0) Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: [Errno 0] Error ``` The bug is caused by the old manual sign check that at some point lost the part that set `errno`: https://github.com/python/cpython/blob/c3a178398c199038f3a0891d09f0363ec73f3b38/Modules/posixmodule.c#L9832-L9834 I'm going to submit a PR with the fix. <!-- gh-linked-prs --> ### Linked PRs * gh-102180 * gh-102419 * gh-102420 <!-- /gh-linked-prs -->