René's URL Explorer Experiment


Title: Error inferring typevar on generic classes · Issue #18706 · python/mypy · GitHub

Open Graph Title: Error inferring typevar on generic classes · Issue #18706 · python/mypy

X Title: Error inferring typevar on generic classes · Issue #18706 · python/mypy

Description: Bug Report The inferred type of methods of a generic class are not bounded to typevar value on descendant classes. To Reproduce from typing import Iterator, Generic, TypeVar T = TypeVar("T", str, int) class Parent(Generic[T]): @classmeth...

Open Graph Description: Bug Report The inferred type of methods of a generic class are not bounded to typevar value on descendant classes. To Reproduce from typing import Iterator, Generic, TypeVar T = TypeVar("T", str, i...

X Description: Bug Report The inferred type of methods of a generic class are not bounded to typevar value on descendant classes. To Reproduce from typing import Iterator, Generic, TypeVar T = TypeVar("T&quo...

Opengraph URL: https://github.com/python/mypy/issues/18706

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Error inferring typevar on generic classes","articleBody":"**Bug Report**\n\nThe inferred type of methods of a generic class are not bounded to typevar value on descendant classes.\n\n\n**To Reproduce**\n\n```python\nfrom typing import Iterator, Generic, TypeVar\n\nT = TypeVar(\"T\", str, int)\n\nclass Parent(Generic[T]):\n\n    @classmethod\n    def method_1(cls, value: T) -> T:\n        return 2*value\n        \n    def method_2(self, value: T) -> T:\n        return 2*value\n        \nclass ChildInt(Parent[int]):\n    pass\n\ninstance = ChildInt()\n\nreveal_type(instance.method_1)  # Revealed type is \"def (value: builtins.int) -> builtins.int\"\nreveal_type(ChildInt.method_1)  # Revealed type is \"def (value: builtins.int) -> builtins.int\"\n\nreveal_type(instance.method_2)  # Revealed type is \"def (value: builtins.int) -> builtins.int\"\nreveal_type(ChildInt.method_2)  # Revealed type is \"def (self: __main__.Parent[T`1], value: T`1) -> T`1\"\n```\n\nhttps://mypy-play.net/?mypy=latest&python=3.12&gist=7ce2739ccc2b43f37187d54dcdd5f923\n\n**Expected Behavior**\n\n```python\nreveal_type(ChildInt.method_2)  # Revealed type is \"def (self: __main__.ChildInt, value: builtins.int) -> builtins.int\"\n```\n\nThis soulution could be acceptable, as well: \n\n```python\nreveal_type(ChildInt.method_2)  # Revealed type is \"def (self: __main__.Parent[builtins.int], value: builtins.int) -> builtins.int\"\n```\n\n**Actual Behavior**\n\n```python\nreveal_type(ChildInt.method_2)  # Revealed type is \"def (self: __main__.Parent[T`1], value: T`1) -> T`1\"\n```\n\n\n**Your Environment**\n\n\u003c!-- Include as many relevant details about the environment you experienced the bug in -->\n\n- Mypy version used: 1.15\n- Mypy command-line flags: no flags\n- Mypy configuration options from `mypy.ini` (and other config files): no config\n- Python version used: 3.13\n\n**Releated issues**\n\n#15658\n","author":{"url":"https://github.com/alfred82santa","@type":"Person","name":"alfred82santa"},"datePublished":"2025-02-19T08:24:49Z","url":"https://github.com/python/mypy/issues/18706"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:4cb29ce7-f430-9ef9-c682-00c2f7a0b3ce
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9A34:1EF2:54EF49:75D75E:6B00154F
html-safe-nonce1ae9bc8ba58ccb1bf14f3f6de14355fb1e2069e3574406bd19adc8596c4820d1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTM0OjFFRjI6NTRFRjQ5Ojc1RDc1RTo2QjAwMTU0RiIsInZpc2l0b3JfaWQiOiIzMTI4MjIxNTcwNjk1NzEzNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaccafb13a3184f890d9e2049acb475ca6aadeb14fc799b953db8e4b01572bbfc86
hovercard-subject-tagissue:2862580582
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/18706/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ce050fd1782aede2ff5f757e21087ae31836ff998ebb4dcaa576914f3466c0ff/python/mypy/issues/18706
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ce050fd1782aede2ff5f757e21087ae31836ff998ebb4dcaa576914f3466c0ff/python/mypy/issues/18706
og:image:altBug Report The inferred type of methods of a generic class are not bounded to typevar value on descendant classes. To Reproduce from typing import Iterator, Generic, TypeVar T = TypeVar("T", str, i...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamealfred82santa
hostnamegithub.com
expected-hostnamegithub.com
Nonea2dd2291b1b13cc9c06f27ec92fa3dbaf34116fc24c9347b8539db61884c59f4
turbo-cache-controlno-preview
go-importgithub.com/python/mypy git https://github.com/python/mypy.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id7053637
octolytics-dimension-repository_nwopython/mypy
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7053637
octolytics-dimension-repository_network_root_nwopython/mypy
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release70121d4e855ee0bb7b75cf15d061d91f8863c0f8
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/18706#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F18706
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F18706
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fmypy
Reloadhttps://github.com/python/mypy/issues/18706
Reloadhttps://github.com/python/mypy/issues/18706
Reloadhttps://github.com/python/mypy/issues/18706
pythonhttps://github.com/python
mypyhttps://github.com/python/mypy
Codehttps://github.com/python/mypy
Issues2.7k (2.7k)https://github.com/python/mypy/issues
Pull requests546 (546)https://github.com/python/mypy/pulls
Actionshttps://github.com/python/mypy/actions
Projectshttps://github.com/python/mypy/projects
Wikihttps://github.com/python/mypy/wiki
Security and qualityhttps://github.com/python/mypy/security
Insightshttps://github.com/python/mypy/insights
https://github.com/python/mypy
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/18706
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/18706
#18943https://github.com/python/mypy/pull/18943
Error inferring typevar on generic classeshttps://github.com/python/mypy/issues/18706#top
#18943https://github.com/python/mypy/pull/18943
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/alfred82santa
alfred82santahttps://github.com/alfred82santa
on Feb 19, 2025https://github.com/python/mypy/issues/18706#issue-2862580582
https://mypy-play.net/?mypy=latest&python=3.12&gist=7ce2739ccc2b43f37187d54dcdd5f923https://mypy-play.net/?mypy=latest&python=3.12&gist=7ce2739ccc2b43f37187d54dcdd5f923
#15658https://github.com/python/mypy/issues/15658
alfred82santahttps://github.com/alfred82santa
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
on Feb 19, 2025https://github.com/python/mypy/issues/18706#event-16361305674
https://github.com/A5rocks
A5rockshttps://github.com/A5rocks
on Feb 19, 2025https://github.com/python/mypy/issues/18706#issuecomment-2668069413
https://github.com/alfred82santa
alfred82santahttps://github.com/alfred82santa
on Feb 19, 2025https://github.com/python/mypy/issues/18706#issuecomment-2668241941
https://mypy-play.net/?mypy=latest&python=3.12&gist=7ce2739ccc2b43f37187d54dcdd5f923https://mypy-play.net/?mypy=latest&python=3.12&gist=7ce2739ccc2b43f37187d54dcdd5f923
https://github.com/alfred82santa
alfred82santahttps://github.com/alfred82santa
on Feb 19, 2025https://github.com/python/mypy/issues/18706#issuecomment-2668752630
https://pyright-play.net/?code=GYJw9gtgBALgngBwJYDsDmUkQWEMoCSMApiAIYy4A0UA4sSqUgMY0AqixAamSDQMJkANkLIAjIcRoBBFHABQ8tlAC8UDgm68AFACI2umgGcYfTChgBKRc1FGjUAAq8GMbfUYgWAbTYBdSwAuRShQqAABWzJ7CGIYAAswABN5MKgk4mAoWITkgH0ARm1bIxoAN2EAV2JA9UsoAFoAPnVgtLSQOMqQFCgAJgAqCqFq1PbQsdCMrJzEpLy%2B7SNiIWByqpq6xpa2NvGoTphu3sHh0f2oeSj7KH54pCEkggttZ06Lb1QYAL3QhGijIpUCYyChmMRVLd7o9nm5rPJOmViMI8vBNNo7g8nhYAHSzfIFepQADEUAASsQkcJiElYJxMA5dNMoNozpsxJUHjBgTivvVmlAOVyeV9dAjKcihKjONpgTBQeC8XE5oUiaSKVTJLS0RCkIzmayNrUhUJuSgjLyLPyWiazRbRYpEZLpejMTDcfj5n01eSJdTtfS9VAmZkWctVrU8nkIGRUFGcW9XL4AAYFPzrEabNip63qVNip0onWy83ysHEJW5L0%2BjWSml0zQM4MGtnGzmmkVW7aC9t2y0wMXyZkZZi4Ci4bwAZT82mAtUEInEkm8U5oX3T5m%2BuYXogkxBXk7XFg369%2BBy6PSgwEmlzSVzsDlo5BQSTd2Lcb9hQRvN89eQAzJCI5jpQIAYtC76Viq3qhKSpDgCAtTSCAaCVLEFhQAUsBgM2xCjuQoG6FA8TROYo7YBQSB7g2EK6DuS77t4iYfP47Abv4ugANxQMQAAemjMCQtJ0cIu7LkxLgsSex5Ht8RFQN4vBoA0Op%2BEAAhttps://pyright-play.net/?code=GYJw9gtgBALgngBwJYDsDmUkQWEMoCSMApiAIYy4A0UA4sSqUgMY0AqixAamSDQMJkANkLIAjIcRoBBFHABQ8tlAC8UDgm68AFACI2umgGcYfTChgBKRc1FGjUAAq8GMbfUYgWAbTYBdSwAuRShQqAABWzJ7CGIYAAswABN5MKgk4mAoWITkgH0ARm1bIxoAN2EAV2JA9UsoAFoAPnVgtLSQOMqQFCgAJgAqCqFq1PbQsdCMrJzEpLy%2B7SNiIWByqpq6xpa2NvGoTphu3sHh0f2oeSj7KH54pCEkggttZ06Lb1QYAL3QhGijIpUCYyChmMRVLd7o9nm5rPJOmViMI8vBNNo7g8nhYAHSzfIFepQADEUAASsQkcJiElYJxMA5dNMoNozpsxJUHjBgTivvVmlAOVyeV9dAjKcihKjONpgTBQeC8XE5oUiaSKVTJLS0RCkIzmayNrUhUJuSgjLyLPyWiazRbRYpEZLpejMTDcfj5n01eSJdTtfS9VAmZkWctVrU8nkIGRUFGcW9XL4AAYFPzrEabNip63qVNip0onWy83ysHEJW5L0%2BjWSml0zQM4MGtnGzmmkVW7aC9t2y0wMXyZkZZi4Ci4bwAZT82mAtUEInEkm8U5oX3T5m%2BuYXogkxBXk7XFg369%2BBy6PSgwEmlzSVzsDlo5BQSTd2Lcb9hQRvN89eQAzJCI5jpQIAYtC76Viq3qhKSpDgCAtTSCAaCVLEFhQAUsBgM2xCjuQoG6FA8TROYo7YBQSB7g2EK6DuS77t4iYfP47Abv4ugANxQMQAAemjMCQtJ0cIu7LkxLgsSex5Ht8RFQN4vBoA0Op%2BEAA
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
on Feb 22, 2025https://github.com/python/mypy/issues/18706#issuecomment-2676032072
https://github.com/A5rocks
A5rockshttps://github.com/A5rocks
on Feb 22, 2025https://github.com/python/mypy/issues/18706#issuecomment-2676040294
https://github.com/python/mypy/pull/18401/files#diff-1dce7e2a19559e2ff4e08fd46877b87c9cfec3cb5e6d465157788542948e11e4R369-R370https://github.com/python/mypy/pull/18401/files#diff-1dce7e2a19559e2ff4e08fd46877b87c9cfec3cb5e6d465157788542948e11e4R369-R370
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
on Feb 22, 2025https://github.com/python/mypy/issues/18706#issuecomment-2676313134
ilevkivskyihttps://github.com/ilevkivskyi
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#18943https://github.com/python/mypy/pull/18943
on May 30, 2025https://github.com/python/mypy/issues/18706#event-17891999808
ilevkivskyihttps://github.com/ilevkivskyi
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
3957025https://github.com/python/mypy/commit/39570250e35151e387e6e1daf08b4f4e4262726e
on May 30, 2025https://github.com/python/mypy/issues/18706#event-17891999830
pullhttps://github.com/apps/pull
on May 30, 2025https://github.com/python/mypy/issues/18706#event-17892394435
Use checkmember.py to check protocol subtyping (python#18943)https://github.com/Dareh123/mypy/commit/39570250e35151e387e6e1daf08b4f4e4262726e
python#18943https://github.com/python/mypy/pull/18943
3957025https://github.com/Dareh123/mypy/commit/39570250e35151e387e6e1daf08b4f4e4262726e
cdce8phttps://github.com/cdce8p
on May 31, 2025https://github.com/python/mypy/issues/18706#event-17902197723
Use checkmember.py to check protocol subtyping (python#18943)https://github.com/cdce8p/mypy/commit/2b175b2cd6fa183fbd0c8320fbb4f96866857ebe
python#18943https://github.com/python/mypy/pull/18943
2b175b2https://github.com/cdce8p/mypy/commit/2b175b2cd6fa183fbd0c8320fbb4f96866857ebe
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/18706
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/18706
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.