René's URL Explorer Experiment


Title: @functools.cache destroys the function signature · Issue #11280 · python/typeshed · GitHub

Open Graph Title: @functools.cache destroys the function signature · Issue #11280 · python/typeshed

X Title: @functools.cache destroys the function signature · Issue #11280 · python/typeshed

Description: A function decorated with @functools.cache loses its signature: @functools.cache def my_func(foo: int | list) -> str: return str(foo) my_func('completely', 'incorrect', 'arguments') # Success: no issues found in 1 source file There is an...

Open Graph Description: A function decorated with @functools.cache loses its signature: @functools.cache def my_func(foo: int | list) -> str: return str(foo) my_func('completely', 'incorrect', 'arguments') # Success: no i...

X Description: A function decorated with @functools.cache loses its signature: @functools.cache def my_func(foo: int | list) -> str: return str(foo) my_func('completely', 'incorrect', 'argu...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@functools.cache destroys the function signature","articleBody":"A function decorated with `@functools.cache`  loses its signature:\r\n\r\n```python\r\n@functools.cache\r\ndef my_func(foo: int | list) -> str:\r\n    return str(foo)\r\n\r\nmy_func('completely', 'incorrect', 'arguments')\r\n# Success: no issues found in 1 source file\r\n```\r\n\r\nThere *is* an error if you try to pass an argument that isn't hashable:\r\n\r\n```python\r\nmy_func([])\r\n# error: Argument 1 to \"__call__\" of \"_lru_cache_wrapper\" has\r\n# incompatible type \"list[Never]\"; expected \"Hashable\"  [arg-type]\r\n```\r\n\r\nBut this completely ruins Intellisense:\r\n\r\n![image](https://github.com/python/typeshed/assets/22036272/a38f7631-6940-4cac-8765-eb57eca5678a)\r\n\r\nI understand that the type system isn't powerful enough to express the correct semantics, which would be this:\r\n\r\n```python\r\n@functools.cache\r\ndef my_func(foo: int | list) -> str:\r\n    return str(foo)\r\n\r\nreveal_type(my_func)  # Callable[[int], str]\r\n```\r\n\r\nThat said, I would much rather have functioning Intellisense than a warning about unhashable inputs.","author":{"url":"https://github.com/Aran-Fey","@type":"Person","name":"Aran-Fey"},"datePublished":"2024-01-16T17:12:51Z","url":"https://github.com/python/typeshed/issues/11280"}

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:c39314d9-e9f8-d9a8-e20d-e05b245f53c7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id97EC:2A4B31:2B4E7:3A906:6B0019F3
html-safe-noncee95079e10cfe6f96516d56d5dcd03d80389456c9e69d2d044dc74708dbe6be68
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5N0VDOjJBNEIzMToyQjRFNzozQTkwNjo2QjAwMTlGMyIsInZpc2l0b3JfaWQiOiI1MTQ4MjMxODM3NTU3OTg3ODI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacc0d8164dffaee0934179f19365179e2caee3e6b4c8195e1f4861a7e58abfc4f0
hovercard-subject-tagissue:2084464702
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/11280/issue_layout
twitter:imagehttps://opengraph.githubassets.com/caa1b7c94185b4f936cd34853ea3b9dc80f2fdc4d055dfd2559f4ecd6aed6a8a/python/typeshed/issues/11280
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/caa1b7c94185b4f936cd34853ea3b9dc80f2fdc4d055dfd2559f4ecd6aed6a8a/python/typeshed/issues/11280
og:image:altA function decorated with @functools.cache loses its signature: @functools.cache def my_func(foo: int | list) -> str: return str(foo) my_func('completely', 'incorrect', 'arguments') # Success: no i...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameAran-Fey
hostnamegithub.com
expected-hostnamegithub.com
Nonea2dd2291b1b13cc9c06f27ec92fa3dbaf34116fc24c9347b8539db61884c59f4
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
release70121d4e855ee0bb7b75cf15d061d91f8863c0f8
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/typeshed/issues/11280#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftypeshed%2Fissues%2F11280
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%2F11280
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/11280
Reloadhttps://github.com/python/typeshed/issues/11280
Reloadhttps://github.com/python/typeshed/issues/11280
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/11280
New issuehttps://github.com/login?return_to=https://github.com/python/typeshed/issues/11280
#11662https://github.com/python/typeshed/pull/11662
@functools.cache destroys the function signaturehttps://github.com/python/typeshed/issues/11280#top
#11662https://github.com/python/typeshed/pull/11662
reason: inexpressibleClosed, because this can't be expressed within the current type systemhttps://github.com/python/typeshed/issues?q=state%3Aopen%20label%3A%22reason%3A%20inexpressible%22
stubs: false negativeType checkers do not report an error, but shouldhttps://github.com/python/typeshed/issues?q=state%3Aopen%20label%3A%22stubs%3A%20false%20negative%22
https://github.com/Aran-Fey
Aran-Feyhttps://github.com/Aran-Fey
on Jan 16, 2024https://github.com/python/typeshed/issues/11280#issue-2084464702
https://private-user-images.githubusercontent.com/22036272/297135500-a38f7631-6940-4cac-8765-eb57eca5678a.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTUxNjkwNTYsIm5iZiI6MTc5NTE2ODc1NiwicGF0aCI6Ii8yMjAzNjI3Mi8yOTcxMzU1MDAtYTM4Zjc2MzEtNjk0MC00Y2FjLTg3NjUtZWI1N2VjYTU2NzhhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjExMjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMTIwVDA5NTkxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQwNzNmNDE1YTc4YTc4YmVlMjRkOGNlNWJiNGRkZGZhN2RjOTI2NzA5NTU0ZTc2YjZlMGNhNTA0MWFmNTI5ODkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.teh0EuGNmMclGW5WB1cDVMifzgYLqvYdVHDQQYq0gYo
srittauhttps://github.com/srittau
stubs: false negativeType checkers do not report an error, but shouldhttps://github.com/python/typeshed/issues?q=state%3Aopen%20label%3A%22stubs%3A%20false%20negative%22
on Jan 16, 2024https://github.com/python/typeshed/issues/11280#event-11502967716
https://github.com/srittau
srittauhttps://github.com/srittau
on Jan 16, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1894376467
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on Jan 16, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1894449565
improve lru_cache by using ParamSpec #7771https://github.com/python/typeshed/pull/7771
functools: Add typing for decorated function arguments in cache API #9768https://github.com/python/typeshed/pull/9768
functools._lru_cache_wrapper should be a descriptor class, not a callable #6347https://github.com/python/typeshed/issues/6347
https://github.com/Daverball
Daverballhttps://github.com/Daverball
on Jan 18, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1898185144
https://github.com/Aran-Fey
Aran-Feyhttps://github.com/Aran-Fey
on Jan 18, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1898318017
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on Jan 18, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1898344082
typeshed/stdlib/contextlib.pyihttps://github.com/python/typeshed/blob/c51de8ee6859b3b1b411d48e56cd537716893e81/stdlib/contextlib.pyi#L76
c51de8ehttps://github.com/python/typeshed/commit/c51de8ee6859b3b1b411d48e56cd537716893e81
typeshed/stdlib/functools.pyihttps://github.com/python/typeshed/blob/c51de8ee6859b3b1b411d48e56cd537716893e81/stdlib/functools.pyi#L201
c51de8ehttps://github.com/python/typeshed/commit/c51de8ee6859b3b1b411d48e56cd537716893e81
#6356https://github.com/python/typeshed/pull/6356
#7771https://github.com/python/typeshed/pull/7771
https://github.com/Aran-Fey
Aran-Feyhttps://github.com/Aran-Fey
on Jan 18, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1898479254
https://github.com/Daverball
Daverballhttps://github.com/Daverball
on Jan 18, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1898496298
@Aran-Feyhttps://github.com/Aran-Fey
https://github.com/Aran-Fey
Aran-Feyhttps://github.com/Aran-Fey
on Jan 18, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1898508627
https://github.com/umarbutler
umarbutlerhttps://github.com/umarbutler
on Mar 11, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1987620682
https://github.com/Daverball
Daverballhttps://github.com/Daverball
on Mar 11, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1988273846
https://github.com/umarbutler
umarbutlerhttps://github.com/umarbutler
on Mar 11, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1988286818
https://private-user-images.githubusercontent.com/8473183/311696210-bb38ef90-fcc6-402a-a422-707bae82f456.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTUxNjkwNTYsIm5iZiI6MTc5NTE2ODc1NiwicGF0aCI6Ii84NDczMTgzLzMxMTY5NjIxMC1iYjM4ZWY5MC1mY2M2LTQwMmEtYTQyMi03MDdiYWU4MmY0NTYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MTEyMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjExMjBUMDk1OTE2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NDZlYWEwZDg3MmI0MmExZjJjMjBmODNkMjMxOGNkMDJkYzY4MWI1ZWU0YzY2YzJkYmQzMDZjODMxZjM0ZTA2ZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0._fAXjwq82cRN2ErD_YMxan-ay79BOWw67GdJwIlTP10
https://github.com/Daverball
Daverballhttps://github.com/Daverball
on Mar 11, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1988386839
https://mypy-play.net/?mypy=latest&python=3.12https://mypy-play.net/?mypy=latest&python=3.12
https://pyright-play.net/?pythonVersion=3.12&code=JYWwDg9gTgLgBAMwK4DsDGMIQDYGcCwAUEQCYCmCcIAngPrLozAQoAUAlHALQB8cAcizIAuInHFwwAQ1wFihGvVQZmKOAF5EyzDlwA6AO5QpYXK0UMVLdq0s68etFLQALMubp3V7dkShkANzIpbFoYajB3C21vP0Dg0PDIjyVGVT1aWidsUNp2IAhttps://pyright-play.net/?pythonVersion=3.12&code=JYWwDg9gTgLgBAMwK4DsDGMIQDYGcCwAUEQCYCmCcIAngPrLozAQoAUAlHALQB8cAcizIAuInHFwwAQ1wFihGvVQZmKOAF5EyzDlwA6AO5QpYXK0UMVLdq0s68etFLQALMubp3V7dkShkANzIpbFoYajB3C21vP0Dg0PDIjyVGVT1aWidsUNp2IA
https://github.com/ldorigo
ldorigohttps://github.com/ldorigo
on Mar 13, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1994521675
@Aran-Feyhttps://github.com/Aran-Fey
https://github.com/Daverball
Daverballhttps://github.com/Daverball
on Mar 13, 2024https://github.com/python/typeshed/issues/11280#issuecomment-1994544693
@Aran-Feyhttps://github.com/Aran-Fey
https://github.com/umarbutler
umarbutlerhttps://github.com/umarbutler
on Mar 17, 2024https://github.com/python/typeshed/issues/11280#issuecomment-2002410433
@Daverballhttps://github.com/Daverball
AlexWaygoodhttps://github.com/AlexWaygood
Use ParamSpec for lru_cache #11662https://github.com/python/typeshed/pull/11662
on Mar 26, 2024https://github.com/python/typeshed/issues/11280#event-12252253072
https://github.com/alwaysmpe
alwaysmpehttps://github.com/alwaysmpe
on Nov 3, 2024https://github.com/python/typeshed/issues/11280#issuecomment-2453262611
discussionhttps://discuss.python.org/t/allow-self-binding-for-generic-paramspec/50948/4
nickurakhttps://github.com/nickurak
on May 26, 2025https://github.com/python/typeshed/issues/11280#event-17806903898
theory: change _get_chords_from_notes notes parameter type to Iteroblahttps://github.com/nickurak/ukechords/commit/c5784ce35c23b7c17648dbe77c9a9d3bdfc4c39b
c5784cehttps://github.com/nickurak/ukechords/commit/c5784ce35c23b7c17648dbe77c9a9d3bdfc4c39b
srittauhttps://github.com/srittau
on Sep 23, 2025https://github.com/python/typeshed/issues/11280#event-19861894794
Use ParamSpec _lru_cache_wrapperhttps://github.com/srittau/typeshed/commit/9fb53ff311095fd82c1b4453a0732efe850a373f
https://docs.github.com/articles/closing-issues-via-commit-messages
9fb53ffhttps://github.com/srittau/typeshed/commit/9fb53ff311095fd82c1b4453a0732efe850a373f
https://github.com/srittau
srittauhttps://github.com/srittau
on Sep 23, 2025https://github.com/python/typeshed/issues/11280#issuecomment-3323297714
srittauhttps://github.com/srittau
not plannedhttps://github.com/python/typeshed/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on Sep 23, 2025https://github.com/python/typeshed/issues/11280#event-19862281932
srittauhttps://github.com/srittau
reason: inexpressibleClosed, because this can't be expressed within the current type systemhttps://github.com/python/typeshed/issues?q=state%3Aopen%20label%3A%22reason%3A%20inexpressible%22
on Sep 23, 2025https://github.com/python/typeshed/issues/11280#event-19862285638
nickurakhttps://github.com/nickurak
on Dec 14, 2025https://github.com/python/typeshed/issues/11280#event-21551961441
theory: change _get_chords_from_notes notes parameter type to Iteroblahttps://github.com/nickurak/ukechords/commit/bb315c61fdb72901027095b0c111d71e7daaaaa3
bb315c6https://github.com/nickurak/ukechords/commit/bb315c61fdb72901027095b0c111d71e7daaaaa3
JelleZijlstrahttps://github.com/JelleZijlstra
on May 2, 2026https://github.com/python/typeshed/issues/11280#event-25099778574
Add tests for @functools.cache (#14768)https://github.com/python/typeshed/commit/44dac880beafef55e6a7dd350c6a484a1c35e112
#14768https://github.com/python/typeshed/pull/14768
https://docs.github.com/articles/closing-issues-via-commit-messages
44dac88https://github.com/python/typeshed/commit/44dac880beafef55e6a7dd350c6a484a1c35e112
https://github.com/zoltan-axle
zoltan-axlehttps://github.com/zoltan-axle
on May 26, 2026https://github.com/python/typeshed/issues/11280#issuecomment-4543685218
tkem/cachetools#398https://github.com/tkem/cachetools/pull/398
https://github.com/srittau
srittauhttps://github.com/srittau
on May 26, 2026https://github.com/python/typeshed/issues/11280#issuecomment-4543803164
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/typeshed/issues/11280
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/typeshed/issues/11280
reason: inexpressibleClosed, because this can't be expressed within the current type systemhttps://github.com/python/typeshed/issues?q=state%3Aopen%20label%3A%22reason%3A%20inexpressible%22
stubs: false negativeType checkers do not report an error, but shouldhttps://github.com/python/typeshed/issues?q=state%3Aopen%20label%3A%22stubs%3A%20false%20negative%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.