Title: Error when choosing subclass of ABC from more than one option in a dictionary · Issue #5135 · python/mypy · GitHub
Open Graph Title: Error when choosing subclass of ABC from more than one option in a dictionary · Issue #5135 · python/mypy
X Title: Error when choosing subclass of ABC from more than one option in a dictionary · Issue #5135 · python/mypy
Description: Are you reporting a bug, or opening a feature request? Reporting a bug. Please insert below the code you are checking with mypy import abc class A(abc.ABC): @abc.abstractmethod def foo(self): pass class B(A): def foo(self): pass class C(...
Open Graph Description: Are you reporting a bug, or opening a feature request? Reporting a bug. Please insert below the code you are checking with mypy import abc class A(abc.ABC): @abc.abstractmethod def foo(self): pass ...
X Description: Are you reporting a bug, or opening a feature request? Reporting a bug. Please insert below the code you are checking with mypy import abc class A(abc.ABC): @abc.abstractmethod def foo(self): pass ...
Opengraph URL: https://github.com/python/mypy/issues/5135
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Error when choosing subclass of ABC from more than one option in a dictionary","articleBody":"> Are you reporting a bug, or opening a feature request?\r\n\r\nReporting a bug.\r\n\r\n> Please insert below the code you are checking with mypy\r\n\r\n```python\r\nimport abc\r\n\r\nclass A(abc.ABC):\r\n\r\n @abc.abstractmethod\r\n def foo(self):\r\n pass\r\n\r\nclass B(A):\r\n\r\n def foo(self):\r\n pass\r\n\r\nclass C(A):\r\n\r\n def foo(self):\r\n pass\r\n\r\ncls_b = {1: B}[1]\r\ncls_b()\r\n\r\ncls_c = {2: C}[2]\r\ncls_c()\r\n\r\ncls_b_2 = {1: B, 2: C}[1]\r\n# mypy error here:\r\n# example.py:26: error: Cannot instantiate abstract class 'A' with abstract attribute 'foo'\r\ncls_b_2()\r\n```\r\n\r\n> What is the actual behavior/output?\r\n\r\n```\r\n# example.py:26: error: Cannot instantiate abstract class 'A' with abstract attribute 'foo'\r\n```\r\n\r\n> What is the behavior/output you expect?\r\n\r\nNo error.\r\n\r\n> What are the versions of mypy and Python you are using?\r\n\r\nmypy 0.600\r\nPython 3.6.5\r\n\r\n> Do you see the same issue after installing mypy from Git master?\r\n\r\nYes\r\n\r\n> What are the mypy flags you are using? (For example --strict-optional)\r\n\r\nNo flags.","author":{"url":"https://github.com/adamtheturtle","@type":"Person","name":"adamtheturtle"},"datePublished":"2018-06-02T14:52:59Z","url":"https://github.com/python/mypy/issues/5135"}
| 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:3456eacf-8fd9-7bf2-5821-3d52738a64a1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E934:31B434:146747E:1AA4580:6B000943 |
| html-safe-nonce | b679dfd163bb7650e2b48f6a861b39e79715b8435fc369c3ff185edccfab77b1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTM0OjMxQjQzNDoxNDY3NDdFOjFBQTQ1ODA6NkIwMDA5NDMiLCJ2aXNpdG9yX2lkIjoiOTAyMjM4MTUxMDY2MDk4MzEwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 500850da3809555421ef4faecf7f520bb845ff76337cfd659c6794b479a7abfd |
| hovercard-subject-tag | issue:328750346 |
| 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/5135/issue_layout |
| twitter:image | https://opengraph.githubassets.com/26093dbd47f8cfa654030ef6471d28478b209b831630d38375fe27231dfb3775/python/mypy/issues/5135 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/26093dbd47f8cfa654030ef6471d28478b209b831630d38375fe27231dfb3775/python/mypy/issues/5135 |
| og:image:alt | Are you reporting a bug, or opening a feature request? Reporting a bug. Please insert below the code you are checking with mypy import abc class A(abc.ABC): @abc.abstractmethod def foo(self): pass ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | adamtheturtle |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width