Title: Bogus undefined name error with generic type alias · Issue #7092 · python/mypy · GitHub
Open Graph Title: Bogus undefined name error with generic type alias · Issue #7092 · python/mypy
X Title: Bogus undefined name error with generic type alias · Issue #7092 · 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. Th...
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 s...
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 s...
Opengraph URL: https://github.com/python/mypy/issues/7092
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bogus undefined name error with generic type alias","articleBody":"* Are you reporting a bug, or opening a feature request?\r\n\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\nThis requires two modules to trigger the bug:\r\ndummy.py:\r\n```py\r\nfrom typing import Type, TypeVar, Callable\r\n\r\nT = TypeVar('T')\r\nImplementationFactory = Callable[[Type[T]], T]\r\n\r\nMyFactory = ImplementationFactory[str] # Works fine\r\n```\r\n\r\ndummy2.py:\r\n```py\r\nimport dummy\r\n\r\nMyFactory2 = dummy.ImplementationFactory[str]\r\n```\r\n\r\n* What is the actual behavior/output?\r\n```\r\n$ mypy dummy2.py\r\ndummy2.py:4: error: Name 'T' is not defined\r\n```\r\n\r\nNote that line 4 is empty. You can also add comments to get a different line number displacement. Also note that `T` is never referred to in `dummy2`.\r\n\r\n* What is the behavior/output you expect?\r\n\r\nI would expect no errors for this code.\r\n\r\n* What are the versions of mypy and Python you are using?\r\n\r\n```\r\n$ mypy --version\r\nmypy 0.711\r\n$ python --version\r\nPython 3.7.3\r\n```\r\n\r\n* Do you see the same issue after installing mypy from Git master?\r\n\r\nI didn't try.\r\n\r\n* What are the mypy flags you are using? (For example --strict-optional)\r\n\r\nNone. The command line is shown in full, there is no config file.\r\n","author":{"url":"https://github.com/Oberon00","@type":"Person","name":"Oberon00"},"datePublished":"2019-06-28T13:17:44Z","url":"https://github.com/python/mypy/issues/7092"}
| 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:00707afa-0531-bae5-174b-7974eec1101f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A85C:21E5F:4B72BC:657403:6B002F0D |
| html-safe-nonce | 5a6334649bedf834377c40a151e53ad86c117695334b7e0f6a7291779c7b9134 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODVDOjIxRTVGOjRCNzJCQzo2NTc0MDM6NkIwMDJGMEQiLCJ2aXNpdG9yX2lkIjoiODQ4MDgyMTk1MzYzOTMzOTY1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 24736ea330d959f7e73a61aac3b256e1decf989eb477d81b8f976793daa40756 |
| hovercard-subject-tag | issue:462030592 |
| 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/7092/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cc354e08a67a76ab222f7199f3ac190a8d1d5094f83962c8f07ce66870f54429/python/mypy/issues/7092 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cc354e08a67a76ab222f7199f3ac190a8d1d5094f83962c8f07ce66870f54429/python/mypy/issues/7092 |
| 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 s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Oberon00 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width