Title: Unexpected error when inheriting a class from Popen and overriding some method in it · Issue #7597 · python/mypy · GitHub
Open Graph Title: Unexpected error when inheriting a class from Popen and overriding some method in it · Issue #7597 · python/mypy
X Title: Unexpected error when inheriting a class from Popen and overriding some method in it · Issue #7597 · python/mypy
Description: Are you reporting a bug, or opening a feature request? Bug Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to simplify your case to a minimal repro. imp...
Open Graph Description: Are you reporting a bug, or opening a feature request? Bug Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to si...
X Description: Are you reporting a bug, or opening a feature request? Bug Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to si...
Opengraph URL: https://github.com/python/mypy/issues/7597
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unexpected error when inheriting a class from Popen and overriding some method in it","articleBody":"* Are you reporting a bug, or opening a feature request?\r\nBug\r\n\r\n* Please insert below the code you are checking with mypy,\r\n or a mock-up repro if the source is private. We would appreciate\r\n if you try to simplify your case to a minimal repro.\r\n\r\n```python\r\nimport subprocess\r\nfrom typing import List, Tuple\r\n\r\n\r\nclass MyPopen(subprocess.Popen):\r\n\r\n def communicate(self, _input=None, _timeout=None) -> Tuple[bytes, bytes]:\r\n return super().communicate(_input, _timeout)\r\n\r\ndef interactive_spawn(cmd: List[str], **kwargs) -> MyPopen:\r\n process = MyPopen(cmd, **kwargs)\r\n process.communicate()\r\n return process\r\n```\r\n\r\n* What is the actual behavior/output?\r\n```\r\n$ mypy mypy_subprocess.py\r\nmypy_subprocess.py:13: error: Incompatible return value type (got \"Popen[Any]\", expected \"MyPopen\")\r\nFound 1 error in 1 file (checked 1 source file)\r\n````\r\n\r\n* What is the behavior/output you expect?\r\n```\r\n$ mypy mypy_subprocess.py\r\nSuccess: no issues found in 1 source file\r\n```\r\n\r\n* What are the versions of mypy and Python you are using?\r\n Do you see the same issue after installing mypy from Git master?\r\n```\r\n$ mypy --version\r\nmypy 0.730\r\n```\r\n\r\n```\r\n(env) $ mypy --version\r\nmypy 0.740+dev.583b99e5096c979043a63dcf92bf3f0d5993d03a\r\n```\r\n\r\n**NOTE: it's not reproducing with `0.720`**\r\n\r\n```\r\n$ python --version\r\nPython 3.7.4\r\n```\r\n\r\n* What are the mypy flags you are using? (For example --strict-optional)\r\n-\r\n\r\n* If mypy crashed with a traceback, please paste\r\n the full traceback below.\r\n-","author":{"url":"https://github.com/actionless","@type":"Person","name":"actionless"},"datePublished":"2019-10-01T23:54:52Z","url":"https://github.com/python/mypy/issues/7597"}
| 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:006ce52b-158d-c07c-72a8-47d9d94a329c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C9FA:2E9DBB:20F39A2:2CF0318:6B0024DB |
| html-safe-nonce | ad51b815b8261c0dae424691c0529a82ffeb7618e4e3691126f5f3e99ca11fa1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOUZBOjJFOURCQjoyMEYzOUEyOjJDRjAzMTg6NkIwMDI0REIiLCJ2aXNpdG9yX2lkIjoiMTk0OTAzODY0NTg0MzMzODQ1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | acf5365425c8dede1f0545b530a081b598b53c50476245a0a890aff3cba5cd87 |
| hovercard-subject-tag | issue:501202532 |
| 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/mypy/7597/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c0fd7e2d1e81ba81c9a91b1b8b2aa55ab445edf9690068f7ea6ce8bdd665bfd1/python/mypy/issues/7597 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c0fd7e2d1e81ba81c9a91b1b8b2aa55ab445edf9690068f7ea6ce8bdd665bfd1/python/mypy/issues/7597 |
| og:image:alt | Are you reporting a bug, or opening a feature request? Bug Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to si... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | actionless |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| 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