Title: Parameters for a call to a function wrapped in a lru_cache are not checked · Issue #16261 · python/mypy · GitHub
Open Graph Title: Parameters for a call to a function wrapped in a lru_cache are not checked · Issue #16261 · python/mypy
X Title: Parameters for a call to a function wrapped in a lru_cache are not checked · Issue #16261 · python/mypy
Description: Bug Report The parameters used in a call to a function which is wrapped in a functools.lru_cache are not checked. To Reproduce from datetime import date from functools import lru_cache @lru_cache def f(v: str, at: date) -> str: return v ...
Open Graph Description: Bug Report The parameters used in a call to a function which is wrapped in a functools.lru_cache are not checked. To Reproduce from datetime import date from functools import lru_cache @lru_cache d...
X Description: Bug Report The parameters used in a call to a function which is wrapped in a functools.lru_cache are not checked. To Reproduce from datetime import date from functools import lru_cache @lru_cache d...
Opengraph URL: https://github.com/python/mypy/issues/16261
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Parameters for a call to a function wrapped in a lru_cache are not checked","articleBody":"**Bug Report**\r\n\r\nThe parameters used in a call to a function which is wrapped in a `functools.lru_cache` are not checked.\r\n\r\n**To Reproduce**\r\n\r\n```python\r\nfrom datetime import date\r\nfrom functools import lru_cache\r\n\r\n@lru_cache\r\ndef f(v: str, at: date) -> str:\r\n return v\r\n\r\nf()\r\nf(\"abc\")\r\nf(\"abc\", date.today())\r\nf(\"abc\", now=date.today())\r\nf(\"abc\", at=date.today())\r\nf(\"abc\", at=\"wrong_type\")\r\n```\r\n\r\n**Expected Behavior**\r\n\r\nThis should raise several errors about the arguments being wrong. Commenting out the line `@lru_cache` correctly generates the following errors.\r\n\r\n```\r\nlru_cache_type_test.py:8: error: Missing positional arguments \"v\", \"at\" in call to \"f\" [call-arg]\r\nlru_cache_type_test.py:9: error: Missing positional argument \"at\" in call to \"f\" [call-arg]\r\nlru_cache_type_test.py:11: error: Unexpected keyword argument \"now\" for \"f\" [call-arg]\r\nlru_cache_type_test.py:13: error: Argument \"at\" to \"f\" has incompatible type \"str\"; expected \"date\" [arg-type]\r\n```\r\n\r\n**Actual Behavior**\r\n\r\n`Success: no issues found in 1 source file`\r\n\r\n**Your Environment**\r\n\r\nmypy 1.6.0 running on Python 3.11.6\r\n","author":{"url":"https://github.com/andrewjw","@type":"Person","name":"andrewjw"},"datePublished":"2023-10-13T16:16:00Z","url":"https://github.com/python/mypy/issues/16261"}
| 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:590f5788-327f-d57b-c1ff-a09f8e6f81c6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D7CA:5537E:1531E7D:1BD848D:6B000E62 |
| html-safe-nonce | 2c555eaa2b8e3848a3bd3656cc8591aa4aae7f73eb3a52a1f39043cd470d9111 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0NBOjU1MzdFOjE1MzFFN0Q6MUJEODQ4RDo2QjAwMEU2MiIsInZpc2l0b3JfaWQiOiI3ODYwNjM3MzQ0MzY0MjM2Mzg2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 0b344182e735777c9c0d89f7bd06b1f1703020efd4fc391c963f2a8b90c3600f |
| hovercard-subject-tag | issue:1942237973 |
| 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/16261/issue_layout |
| twitter:image | https://opengraph.githubassets.com/73b16d075901850348d1dc6b28eedbca4a60daaac66d9c042dfea54b5b41892e/python/mypy/issues/16261 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/73b16d075901850348d1dc6b28eedbca4a60daaac66d9c042dfea54b5b41892e/python/mypy/issues/16261 |
| og:image:alt | Bug Report The parameters used in a call to a function which is wrapped in a functools.lru_cache are not checked. To Reproduce from datetime import date from functools import lru_cache @lru_cache d... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | andrewjw |
| hostname | github.com |
| expected-hostname | github.com |
| None | cf7ee0062053ad9eb05b6e5de57bd96c2055708bcbada4144946b5ec129cf1d7 |
| 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 | 9cab7de176a56362d2aabcbb4d1e07e846eba8a0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width