Title: os.dup2() raises wrong OSError for negative fds · Issue #102179 · python/cpython · GitHub
Open Graph Title: os.dup2() raises wrong OSError for negative fds · Issue #102179 · python/cpython
X Title: os.dup2() raises wrong OSError for negative fds · Issue #102179 · python/cpython
Description: >>> os.dup2(-1, 0) Traceback (most recent call last): File "
Open Graph Description: >>> os.dup2(-1, 0) Traceback (most recent call last): File "
X Description: >>> 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...
Opengraph URL: https://github.com/python/cpython/issues/102179
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"os.dup2() raises wrong OSError for negative fds","articleBody":"\u003c!--\r\n 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\r\n the right place to seek help. Consider the following options instead:\r\n\r\n - reading the Python tutorial: https://docs.python.org/3/tutorial/\r\n - posting in the \"Users\" category on discuss.python.org: https://discuss.python.org/c/users/7\r\n - emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list\r\n - searching our issue tracker (https://github.com/python/cpython/issues) to see if\r\n your problem has already been reported\r\n--\u003e\r\n```\r\n\u003e\u003e\u003e os.dup2(-1, 0)\r\nTraceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n OSError: [Errno 0] Error\r\n```\r\n\r\nThe 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\r\n\r\nI'm going to submit a PR with the fix.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-102180\n* gh-102419\n* gh-102420\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/izbyshev","@type":"Person","name":"izbyshev"},"datePublished":"2023-02-23T15:04:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/102179/cpython/issues/102179"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f71079ab-84fa-4705-c5aa-0926708709e9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 820E:2C4B08:67D7CD:8BE348:6969D9C5 |
| html-safe-nonce | 7f7ccf98873da41f5002d7fc22b44bb7a177dd19b6601dc0fb7964907f730678 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjBFOjJDNEIwODo2N0Q3Q0Q6OEJFMzQ4OjY5NjlEOUM1IiwidmlzaXRvcl9pZCI6IjM3Njc1NzQ1MDI0MTc0ODgzMjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 69301c51b7b14c24c0c4146b3b841dc3f3d51cf3fee6c97c52416d670fd18a5e |
| hovercard-subject-tag | issue:1597028173 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/102179/issue_layout |
| twitter:image | https://opengraph.githubassets.com/674c851c178e771c901fb0683cfb2c5d3ee353bac98778a649b8fede86dcc88d/python/cpython/issues/102179 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/674c851c178e771c901fb0683cfb2c5d3ee353bac98778a649b8fede86dcc88d/python/cpython/issues/102179 |
| og:image:alt | >>> os.dup2(-1, 0) Traceback (most recent call last): File " |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | izbyshev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width