René's URL Explorer Experiment


Title: Class with function fields incorrectly thinks first argument is self · Issue #5485 · python/mypy · GitHub

Open Graph Title: Class with function fields incorrectly thinks first argument is self · Issue #5485 · python/mypy

X Title: Class with function fields incorrectly thinks first argument is self · Issue #5485 · python/mypy

Description: This is a bug report. Minimal repro from dataclasses import dataclass from typing import Callable @dataclass class Repro: fn: Callable[[int], str] r = Repro(fn=repr) assert "1" == r.fn(1) Works correctly when dataclass is not used, i.e. ...

Open Graph Description: This is a bug report. Minimal repro from dataclasses import dataclass from typing import Callable @dataclass class Repro: fn: Callable[[int], str] r = Repro(fn=repr) assert "1" == r.fn(1) Works cor...

X Description: This is a bug report. Minimal repro from dataclasses import dataclass from typing import Callable @dataclass class Repro: fn: Callable[[int], str] r = Repro(fn=repr) assert "1" == r.fn(1)...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Class with function fields incorrectly thinks first argument is self","articleBody":"This is a bug report.\r\n\r\n# Minimal repro\r\n\r\n```python\r\nfrom dataclasses import dataclass\r\nfrom typing import Callable\r\n\r\n@dataclass\r\nclass Repro:\r\n    fn: Callable[[int], str]\r\n\r\nr = Repro(fn=repr)\r\nassert \"1\" == r.fn(1)\r\n```\r\n\r\nWorks correctly when dataclass is not used, i.e. when `Repro` is\r\n\r\n```python\r\nclass Repro:\r\n    def __init__(self, fn: Callable[[int], str]) -> None:\r\n        self.fn = fn\r\n```\r\n\r\n## Actual behavior\r\n\r\n```python\r\nrepro.py:9: error: Invalid self argument \"Repro\" to attribute function \"fn\" with type \"Callable[[int], str]\"\r\nrepro.py:9: error: Too many arguments\r\n```\r\n\r\nWhen running with Python, works correctly. Doesn't throw any exceptions.\r\n\r\n## Expected behavior\r\n\r\nSuccessful type check\r\n\r\n# Environment\r\n\r\n## Versions\r\n\r\nTested with two versions, 0.620 and current version from GitHub.\r\n\r\n* Python 3.7.0\r\n* mypy 0.620\r\n* mypy 0.630+dev-a2ffde90635baf05e264f8d899f5705c52b27c2a\r\n\r\n## Mypy config\r\n\r\n```ini\r\n[mypy]\r\nwarn_redundant_casts = True\r\nwarn_unused_ignores = True\r\nincremental = True\r\n\r\nfollow_imports = normal\r\nignore_missing_imports = True\r\ndisallow_untyped_calls = True\r\ndisallow_untyped_defs = True\r\ncheck_untyped_defs = True\r\nwarn_return_any = True\r\nwarn_no_return = True\r\nno_implicit_optional = True\r\nstrict_optional = True\r\n```\r\n","author":{"url":"https://github.com/Dentosal","@type":"Person","name":"Dentosal"},"datePublished":"2018-08-15T11:31:23Z","url":"https://github.com/python/mypy/issues/5485"}

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:93c58888-120c-89da-2aa6-77d8a943b159
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB174:144E47:26063E0:319067E:6AFFF7D8
html-safe-noncefb241d5f9b6a6bfe01c428d4d93f97f56e186c2e8bc6163eacfa785ae9d81728
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTc0OjE0NEU0NzoyNjA2M0UwOjMxOTA2N0U6NkFGRkY3RDgiLCJ2aXNpdG9yX2lkIjoiMTQzNTI2NTYxNjk4OTY0ODg1NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacfc29ba5aca6eacdad4bc63ffa70fc4018c3bd1bff1789714b3436b5a1854aa49
hovercard-subject-tagissue:350776529
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/5485/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c18e709c2b5088215d1510ab23f600761b86c05afcdfaf78aa0273cc2e148f6b/python/mypy/issues/5485
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c18e709c2b5088215d1510ab23f600761b86c05afcdfaf78aa0273cc2e148f6b/python/mypy/issues/5485
og:image:altThis is a bug report. Minimal repro from dataclasses import dataclass from typing import Callable @dataclass class Repro: fn: Callable[[int], str] r = Repro(fn=repr) assert "1" == r.fn(1) Works cor...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameDentosal
hostnamegithub.com
expected-hostnamegithub.com
None0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729
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
release16a11879678aaf97e2a42c33ee70830aa084fa37
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/5485#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F5485
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%2F5485
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/5485
Reloadhttps://github.com/python/mypy/issues/5485
Reloadhttps://github.com/python/mypy/issues/5485
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 requests547 (547)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/5485
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/5485
#13400https://github.com/python/mypy/pull/13400
#10548https://github.com/python/mypy/pull/10548
Class with function fields incorrectly thinks first argument is selfhttps://github.com/python/mypy/issues/5485#top
#13400https://github.com/python/mypy/pull/13400
#10548https://github.com/python/mypy/pull/10548
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
false-positivemypy gave an error on correct codehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22false-positive%22
priority-1-normalhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-1-normal%22
topic-dataclasseshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-dataclasses%22
https://github.com/Dentosal
Dentosalhttps://github.com/Dentosal
on Aug 15, 2018https://github.com/python/mypy/issues/5485#issue-350776529
Nexthttps://github.com/python/mypy/issues/5485?timeline_page=1
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Aug 15, 2018https://github.com/python/mypy/issues/5485#issuecomment-413196438
#708https://github.com/python/mypy/issues/708
ilevkivskyihttps://github.com/ilevkivskyi
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
priority-1-normalhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-1-normal%22
false-positivemypy gave an error on correct codehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22false-positive%22
on Aug 15, 2018https://github.com/python/mypy/issues/5485#event-1790007681
https://github.com/vim345
vim345https://github.com/vim345
on Sep 24, 2018https://github.com/python/mypy/issues/5485#issuecomment-424119886
ilevkivskyihttps://github.com/ilevkivskyi
topic-pluginsThe plugin API and ideas for new pluginshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-plugins%22
on Sep 25, 2018https://github.com/python/mypy/issues/5485#event-1864542999
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Sep 25, 2018https://github.com/python/mypy/issues/5485#issuecomment-424178679
https://github.com/ojii
ojiihttps://github.com/ojii
on Nov 27, 2018https://github.com/python/mypy/issues/5485#issuecomment-441935633
https://github.com/s-knibbs
s-knibbshttps://github.com/s-knibbs
on Mar 27, 2019https://github.com/python/mypy/issues/5485#issuecomment-477162618
callback protocolhttps://mypy.readthedocs.io/en/latest/protocols.html#callback-protocols
https://github.com/no-longer-on-githu-b
no-longer-on-githu-bhttps://github.com/no-longer-on-githu-b
on Jul 17, 2019https://github.com/python/mypy/issues/5485#issuecomment-512168565
JukkaLhttps://github.com/JukkaL
on Aug 29, 2019https://github.com/python/mypy/issues/5485#event-2593747217
https://github.com/TH3CHARLie
TH3CHARLiehttps://github.com/TH3CHARLie
on Jan 21, 2020https://github.com/python/mypy/issues/5485#issuecomment-576801694
@ilevkivskyihttps://github.com/ilevkivskyi
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Jan 22, 2020https://github.com/python/mypy/issues/5485#issuecomment-577135330
@TH3CHARLiehttps://github.com/TH3CHARLie
jacob414https://github.com/jacob414
on Jun 12, 2020https://github.com/python/mypy/issues/5485#event-3437575080
No coverage on kind.py until problems due to python/mypy#5485 is okhttps://github.com/jacob414/kingston/commit/0d0f9c95f1c4726b0da11f4ca1a03df87142ce43
python/mypy#5485https://github.com/python/mypy/issues/5485
0d0f9c9https://github.com/jacob414/kingston/commit/0d0f9c95f1c4726b0da11f4ca1a03df87142ce43
Squashed commit of the following:https://github.com/jacob414/kingston/commit/32a0fe709e391efb34a856146de1410912137092
32a0fe7https://github.com/jacob414/kingston/commit/32a0fe709e391efb34a856146de1410912137092
ilevkivskyihttps://github.com/ilevkivskyi
on Aug 12, 2022https://github.com/python/mypy/issues/5485#event-7182277228
Fix callable instance variable support (python#10548)https://github.com/ilevkivskyi/mypy/commit/8d517090c4a93590f8cf40c3ca23d8c0a7c81527
python#10548https://github.com/python/mypy/pull/10548
https://docs.github.com/articles/closing-issues-via-commit-messages
8d51709https://github.com/ilevkivskyi/mypy/commit/8d517090c4a93590f8cf40c3ca23d8c0a7c81527
ilevkivskyihttps://github.com/ilevkivskyi
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#13400https://github.com/python/mypy/pull/13400
on Aug 13, 2022https://github.com/python/mypy/issues/5485#event-7182579218
ilevkivskyihttps://github.com/ilevkivskyi
on Aug 13, 2022https://github.com/python/mypy/issues/5485#event-7182579235
Fix callable instance variable support (take 2) (#13400)https://github.com/python/mypy/commit/dc9c3040910d2d239f16a4e9d64c12f60b85afc6
#13400https://github.com/python/mypy/pull/13400
dc9c304https://github.com/python/mypy/commit/dc9c3040910d2d239f16a4e9d64c12f60b85afc6
PIG208https://github.com/PIG208
on Sep 3, 2022https://github.com/python/mypy/issues/5485#event-7317485216
Type get_response with a callback protocol.https://github.com/PIG208/django-stubs/commit/755081867edbfcfabc26968cf241d7447fe0252a
7550818https://github.com/PIG208/django-stubs/commit/755081867edbfcfabc26968cf241d7447fe0252a
sobolevnhttps://github.com/sobolevn
on Sep 3, 2022https://github.com/python/mypy/issues/5485#event-7317556803
Reflect the deprecation of get_response being None. (#1086)https://github.com/typeddjango/django-stubs/commit/c0414c7b025b77caf9f72dbaf9e8471e11aad085
#1086https://github.com/typeddjango/django-stubs/pull/1086
c0414c7https://github.com/typeddjango/django-stubs/commit/c0414c7b025b77caf9f72dbaf9e8471e11aad085
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/5485
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/5485
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
false-positivemypy gave an error on correct codehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22false-positive%22
priority-1-normalhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-1-normal%22
topic-dataclasseshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-dataclasses%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.