Title: The result of TextIOWrapper.detach() should be IO[bytes] · Issue #3993 · python/typeshed · GitHub
Open Graph Title: The result of TextIOWrapper.detach() should be IO[bytes] · Issue #3993 · python/typeshed
X Title: The result of TextIOWrapper.detach() should be IO[bytes] · Issue #3993 · python/typeshed
Description: For the following example: import sys, io if isinstance(sys.stdout, io.TextIOWrapper) and sys.version_info < (3, 7): sys.stdout = io.TextIOWrapper( sys.stdout.detach(), encoding="ascii", errors="replace") I get the following error: recon...
Open Graph Description: For the following example: import sys, io if isinstance(sys.stdout, io.TextIOWrapper) and sys.version_info < (3, 7): sys.stdout = io.TextIOWrapper( sys.stdout.detach(), encoding="ascii", errors="re...
X Description: For the following example: import sys, io if isinstance(sys.stdout, io.TextIOWrapper) and sys.version_info < (3, 7): sys.stdout = io.TextIOWrapper( sys.stdout.detach(), encoding="ascii"...
Opengraph URL: https://github.com/python/typeshed/issues/3993
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The result of TextIOWrapper.detach() should be IO[bytes]","articleBody":"For the following example:\r\n```python\r\nimport sys, io\r\n\r\nif isinstance(sys.stdout, io.TextIOWrapper) and sys.version_info \u003c (3, 7):\r\n sys.stdout = io.TextIOWrapper(\r\n sys.stdout.detach(),\r\n encoding=\"ascii\",\r\n errors=\"replace\")\r\n```\r\nI get the following error:\r\n```\r\nreconfigure36.py:5: error: Argument 1 to \"TextIOWrapper\" has incompatible type \"IOBase\"; expected \"IO[bytes]\"\r\n```\r\nShould not `TextIOWrapper.detach()` return `IO[bytes]` instead of `IOBase`?\r\n\r\nReplacing `sys.stdout.detach()` with `sys.stdout.buffer` fixes the complains.","author":{"url":"https://github.com/serhiy-storchaka","@type":"Person","name":"serhiy-storchaka"},"datePublished":"2020-05-14T13:16:05Z","url":"https://github.com/python/typeshed/issues/3993"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:973d30de-971e-d0e5-8de9-cd91c4402714 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C048:24D752:3951C0:4D90EC:6B002930 |
| html-safe-nonce | af3bc4a90310a309909e6b76a4aefd0ac5fe41e4c348489c0de6f299425df528 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDQ4OjI0RDc1MjozOTUxQzA6NEQ5MEVDOjZCMDAyOTMwIiwidmlzaXRvcl9pZCI6IjU0MDg2NTIyMzYwNDM1OTQwMzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c4ce5041d0fa98dae1c6fe8355027b93126256d420221a5ca224dc764d084e69 |
| hovercard-subject-tag | issue:618222737 |
| 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/typeshed/3993/issue_layout |
| twitter:image | https://opengraph.githubassets.com/710ab4a297b7b97f09db7dc6cc962df5be56da66c7ef10e5fecfd96f4b995fae/python/typeshed/issues/3993 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/710ab4a297b7b97f09db7dc6cc962df5be56da66c7ef10e5fecfd96f4b995fae/python/typeshed/issues/3993 |
| og:image:alt | For the following example: import sys, io if isinstance(sys.stdout, io.TextIOWrapper) and sys.version_info < (3, 7): sys.stdout = io.TextIOWrapper( sys.stdout.detach(), encoding="ascii", errors="re... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | serhiy-storchaka |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width