Title: GzipFile not allowed for tarfile.open(fileobj=...) · Issue #5491 · python/typeshed · GitHub
Open Graph Title: GzipFile not allowed for tarfile.open(fileobj=...) · Issue #5491 · python/typeshed
X Title: GzipFile not allowed for tarfile.open(fileobj=...) · Issue #5491 · python/typeshed
Description: minimal reproduction: import gzip import tarfile open('t', 'w').close() with gzip.GzipFile('out.tar.gz', 'wb') as gzipf: with tarfile.open(fileobj=gzipf, mode='w') as tf: tf.add('t') $ python3 t.py $ mypy t.py t.py:7: error: Argument "fi...
Open Graph Description: minimal reproduction: import gzip import tarfile open('t', 'w').close() with gzip.GzipFile('out.tar.gz', 'wb') as gzipf: with tarfile.open(fileobj=gzipf, mode='w') as tf: tf.add('t') $ python3 t.py...
X Description: minimal reproduction: import gzip import tarfile open('t', 'w').close() with gzip.GzipFile('out.tar.gz', 'wb') as gzipf: with tarfile.open(fileobj=gzipf, mode='w...
Opengraph URL: https://github.com/python/typeshed/issues/5491
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"GzipFile not allowed for tarfile.open(fileobj=...)","articleBody":"minimal reproduction:\r\n\r\n```python\r\nimport gzip\r\nimport tarfile\r\n\r\n\r\nopen('t', 'w').close()\r\nwith gzip.GzipFile('out.tar.gz', 'wb') as gzipf:\r\n with tarfile.open(fileobj=gzipf, mode='w') as tf:\r\n tf.add('t')\r\n```\r\n\r\n```console\r\n$ python3 t.py \r\n$ mypy t.py\r\nt.py:7: error: Argument \"fileobj\" to \"open\" has incompatible type \"GzipFile\"; expected \"Optional[IO[bytes]]\"\r\nFound 1 error in 1 file (checked 1 source file)\r\n$ mypy --version\r\nmypy 0.812\r\n```\r\n\r\npresumably `fileobj` should use a `Protocol` of some shape ?","author":{"url":"https://github.com/asottile","@type":"Person","name":"asottile"},"datePublished":"2021-05-18T03:14:44Z","url":"https://github.com/python/typeshed/issues/5491"}
| 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:a0552300-2db7-e2e3-0b50-a8487950af14 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AA02:3FDF0C:444A61:5B65B3:6B002BB4 |
| html-safe-nonce | 622065654e150174ed03611a1db8e677b5cca0e54efbfd81423518e3cb290643 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTAyOjNGREYwQzo0NDRBNjE6NUI2NUIzOjZCMDAyQkI0IiwidmlzaXRvcl9pZCI6IjM3NjMyMzMzMzg0Nzk4ODExNDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1037882378ba65a32296a99ffe497ae648c3807db06db0acee460dbc846e9c52 |
| hovercard-subject-tag | issue:893904440 |
| 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/5491/issue_layout |
| twitter:image | https://opengraph.githubassets.com/307e27c34f91e3d2d805294ccd4a3a7af0b2f3de3080d16356796629735d9d3c/python/typeshed/issues/5491 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/307e27c34f91e3d2d805294ccd4a3a7af0b2f3de3080d16356796629735d9d3c/python/typeshed/issues/5491 |
| og:image:alt | minimal reproduction: import gzip import tarfile open('t', 'w').close() with gzip.GzipFile('out.tar.gz', 'wb') as gzipf: with tarfile.open(fileobj=gzipf, mode='w') as tf: tf.add('t') $ python3 t.py... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | asottile |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width