René's URL Explorer Experiment


Title: functools.wraps does not work on class methods · Issue #10653 · python/typeshed · GitHub

Open Graph Title: functools.wraps does not work on class methods · Issue #10653 · python/typeshed

X Title: functools.wraps does not work on class methods · Issue #10653 · python/typeshed

Description: We recently hit an error using @wraps on a class method in Trio: python-trio/trio#2775 (comment) when checked with pyright. It works fine on mypy, but I'm guessing they might be special-casing wraps usage while pyright doesn't. Minimal r...

Open Graph Description: We recently hit an error using @wraps on a class method in Trio: python-trio/trio#2775 (comment) when checked with pyright. It works fine on mypy, but I'm guessing they might be special-casing wrap...

X Description: We recently hit an error using @wraps on a class method in Trio: python-trio/trio#2775 (comment) when checked with pyright. It works fine on mypy, but I'm guessing they might be special-casing ...

Opengraph URL: https://github.com/python/typeshed/issues/10653

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"functools.wraps does not work on class methods","articleBody":"We recently hit an error using `@wraps` on a class method in Trio: https://github.com/python-trio/trio/issues/2775#issuecomment-1702892474 when checked with pyright. It works fine on mypy, but I'm guessing they might be special-casing wraps usage while pyright doesn't.\r\n\r\nMinimal repro (python 3.11):\r\n```python\r\nfrom functools import wraps\r\nfrom typing import assert_type\r\n\r\n\r\ndef foo(param: int) -> str:\r\n    \"\"\"docstring\"\"\"\r\n    return \"\"\r\n\r\n@wraps(foo)\r\ndef my_function(blah: int) -> str:\r\n    return 'foo'\r\n\r\n# works fine\r\nassert_type(my_function(5), str)\r\n\r\nclass MyOtherClass:\r\n    def bar(self, param: int) -> str:\r\n        \"\"\"docstring\"\"\"\r\n        return \"\"\r\n\r\nclass MyClass:\r\n    @wraps(MyOtherClass.bar)\r\n    def my_method(self, blah: int) -> str:\r\n        return 'foo'\r\n\r\ninstance = MyClass()\r\n# works in mypy, but not pyright\r\nassert_type(instance.my_method(5), str)\r\n```\r\n\r\nmypy 1.5.1 works without any issue, pyright 1.1.325 gives\r\n```\r\n./test.py\r\n  ./test.py:26:13 - error: Argument missing for parameter \"blah\" (reportGeneralTypeIssues)\r\n  ./test.py:26:13 - error: \"assert_type\" mismatch: expected \"str\" but received \"Unknown\" (reportGeneralTypeIssues)\r\n2 errors, 0 warnings, 0 informations \r\n```\r\n\r\nThis smells a lot like the problem with getting functools.cache to work both with methods and functions, see e.g. https://github.com/python/typeshed/issues/6347","author":{"url":"https://github.com/jakkdl","@type":"Person","name":"jakkdl"},"datePublished":"2023-09-02T10:10:21Z","url":"https://github.com/python/typeshed/issues/10653"}

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:73184735-83b3-87c2-9c45-64103475efa0
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB2A4:30263F:1BACDAA:25658EE:6B0005E5
html-safe-nonce64ad56a4f675538be12accaaecf544d67da9a559caf2c54bc3abdcff2a26b00d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkE0OjMwMjYzRjoxQkFDREFBOjI1NjU4RUU6NkIwMDA1RTUiLCJ2aXNpdG9yX2lkIjoiNTU1Mjc2OTkyMzc5MDQwNzE0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac5e7a60310f0dd0a3499259032390ca6a275502d771a19c8ad8abbdefc281f7e2
hovercard-subject-tagissue:1878568188
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/typeshed/10653/issue_layout
twitter:imagehttps://opengraph.githubassets.com/28ff1602f8c44bae9b259741b76ab90021b92b5d2110b696a53402440e0ed304/python/typeshed/issues/10653
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/28ff1602f8c44bae9b259741b76ab90021b92b5d2110b696a53402440e0ed304/python/typeshed/issues/10653
og:image:altWe recently hit an error using @wraps on a class method in Trio: python-trio/trio#2775 (comment) when checked with pyright. It works fine on mypy, but I'm guessing they might be special-casing wrap...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejakkdl
hostnamegithub.com
expected-hostnamegithub.com
None0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729
turbo-cache-controlno-preview
go-importgithub.com/python/typeshed git https://github.com/python/typeshed.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id31696383
octolytics-dimension-repository_nwopython/typeshed
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id31696383
octolytics-dimension-repository_network_root_nwopython/typeshed
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-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/typeshed/issues/10653#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftypeshed%2Fissues%2F10653
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%2Ftypeshed%2Fissues%2F10653
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%2Ftypeshed
Reloadhttps://github.com/python/typeshed/issues/10653
Reloadhttps://github.com/python/typeshed/issues/10653
Reloadhttps://github.com/python/typeshed/issues/10653
pythonhttps://github.com/python
typeshedhttps://github.com/python/typeshed
Codehttps://github.com/python/typeshed
Issues196 (196)https://github.com/python/typeshed/issues
Pull requests251 (251)https://github.com/python/typeshed/pulls
Actionshttps://github.com/python/typeshed/actions
Security and qualityhttps://github.com/python/typeshed/security
Insightshttps://github.com/python/typeshed/insights
https://github.com/python/typeshed
New issuehttps://github.com/login?return_to=https://github.com/python/typeshed/issues/10653
New issuehttps://github.com/login?return_to=https://github.com/python/typeshed/issues/10653
functools.wraps does not work on class methodshttps://github.com/python/typeshed/issues/10653#top
https://github.com/jakkdl
jakkdlhttps://github.com/jakkdl
on Sep 2, 2023https://github.com/python/typeshed/issues/10653#issue-1878568188
python-trio/trio#2775 (comment)https://github.com/python-trio/trio/issues/2775#issuecomment-1702892474
#6347https://github.com/python/typeshed/issues/6347
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on Sep 2, 2023https://github.com/python/typeshed/issues/10653#issuecomment-1703790008
@erictrauthttps://github.com/erictraut
#6670https://github.com/python/typeshed/pull/6670
python/mypy#16009https://github.com/python/mypy/pull/16009
https://github.com/tamird
tamirdhttps://github.com/tamird
on Feb 23, 2024https://github.com/python/typeshed/issues/10653#issuecomment-1961007137
@AlexWaygoodhttps://github.com/AlexWaygood
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on Feb 23, 2024https://github.com/python/typeshed/issues/10653#issuecomment-1961010749
@AlexWaygoodhttps://github.com/AlexWaygood
https://github.com/tamird
tamirdhttps://github.com/tamird
on Feb 23, 2024https://github.com/python/typeshed/issues/10653#issuecomment-1961039387
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on Feb 23, 2024https://github.com/python/typeshed/issues/10653#issuecomment-1961057551
python/mypy@0dd4b6fhttps://github.com/python/mypy/commit/0dd4b6f7576be3d3857fecefb298decdf0711ac7
https://github.com/jakkdl
jakkdlhttps://github.com/jakkdl
on Mar 18, 2024https://github.com/python/typeshed/issues/10653#issuecomment-2004079621
python/mypy#16942https://github.com/python/mypy/pull/16942
AlexWaygoodhttps://github.com/AlexWaygood
completedhttps://github.com/python/typeshed/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Mar 18, 2024https://github.com/python/typeshed/issues/10653#event-12153442580
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on Mar 18, 2024https://github.com/python/typeshed/issues/10653#issuecomment-2004105767
@jakkdlhttps://github.com/jakkdl
https://github.com/jakkdl
jakkdlhttps://github.com/jakkdl
on Mar 19, 2024https://github.com/python/typeshed/issues/10653#issuecomment-2006294004
#6347https://github.com/python/typeshed/issues/6347
AlexWaygoodhttps://github.com/AlexWaygood
on Mar 19, 2024https://github.com/python/typeshed/issues/10653#event-12165563938
srittauhttps://github.com/srittau
on Jun 20, 2024https://github.com/python/typeshed/issues/10653#event-13226670886
Add tests to functools.wrapshttps://github.com/srittau/typeshed/commit/1d73f2d5c2c223058eec80bf245daf0fea03a817
1d73f2dhttps://github.com/srittau/typeshed/commit/1d73f2d5c2c223058eec80bf245daf0fea03a817
JelleZijlstrahttps://github.com/JelleZijlstra
on Jun 22, 2024https://github.com/python/typeshed/issues/10653#event-13250813649
Add tests to functools.wraps (#12173)https://github.com/python/typeshed/commit/95faa1ae24fdbc34e4668e94a7de38737e628f22
#12173https://github.com/python/typeshed/pull/12173
95faa1ahttps://github.com/python/typeshed/commit/95faa1ae24fdbc34e4668e94a7de38737e628f22
https://github.com/srittau
srittauhttps://github.com/srittau
on Jun 24, 2024https://github.com/python/typeshed/issues/10653#issuecomment-2186047948
https://discuss.python.org/t/making-functions-subscriptable-at-runtime/26463/31https://discuss.python.org/t/making-functions-subscriptable-at-runtime/26463/31
max-muotohttps://github.com/max-muoto
on Sep 8, 2024https://github.com/python/typeshed/issues/10653#event-14173101608
Add tests to functools.wraps (python#12173)https://github.com/max-muoto/typeshed/commit/c465da81694d65f6c2b2ca72ed489d057ea02ab2
python#12173https://github.com/python/typeshed/pull/12173
c465da8https://github.com/max-muoto/typeshed/commit/c465da81694d65f6c2b2ca72ed489d057ea02ab2
Qalthoshttps://github.com/Qalthos
on Oct 23, 2024https://github.com/python/typeshed/issues/10653#event-14815914683
Document and hint logger.py (#4305)https://github.com/ansible/molecule/commit/cef2d918b0d92d0f49cac5d864ac34557620addb
#4305https://github.com/ansible/molecule/pull/4305
cef2d91https://github.com/ansible/molecule/commit/cef2d918b0d92d0f49cac5d864ac34557620addb
Benjamincf0https://github.com/Benjamincf0
on Jun 25, 2026https://github.com/python/typeshed/issues/10653#event-27207015702
womp womp wraps is brokenhttps://github.com/Benjamincf0/learning/commit/1228fafc7a81ee4303ec04d852bbeb9fad51b4fb
1228fafhttps://github.com/Benjamincf0/learning/commit/1228fafc7a81ee4303ec04d852bbeb9fad51b4fb
womp womp wraps is brokenhttps://github.com/Benjamincf0/learning/commit/5487518db9907c8f4344b4c718a1dd080f8a6217
5487518https://github.com/Benjamincf0/learning/commit/5487518db9907c8f4344b4c718a1dd080f8a6217
womp womp wraps is brokenhttps://github.com/Benjamincf0/learning/commit/92c3529763d460fec866b17b0127881f432b21fe
92c3529https://github.com/Benjamincf0/learning/commit/92c3529763d460fec866b17b0127881f432b21fe
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/typeshed/issues/10653
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/typeshed/issues/10653
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.