Title: gh-104050: Argument clinic: enable mypy's `--warn-return-any` setting by AlexWaygood · Pull Request #107405 · python/cpython · GitHub
Open Graph Title: gh-104050: Argument clinic: enable mypy's `--warn-return-any` setting by AlexWaygood · Pull Request #107405 · python/cpython
X Title: gh-104050: Argument clinic: enable mypy's `--warn-return-any` setting by AlexWaygood · Pull Request #107405 · python/cpython
Description: Mypy's --warn-return-any check flags when a function is declared to return a specific type, but mypy can't verify whether it's actually returning that type or not -- it can only infer a vague, unsafe Any type as the returned type. This can often lead to bugs slipping beneath the radar. In the case of argument clinic, the check only flags a single function. But, turns out that it's a true positive! The function is incorrectly annotated at the moment -- the annotation says that it returns a FunctionType, but that's not true. The function creates a FunctionType instance fn, and then returns whatever calling fn returns returns. Therefore, the proper return annotation for this function is -> Any, not -> FunctionType. Closes #104050! Issue: gh-104050
Open Graph Description: Mypy's --warn-return-any check flags when a function is declared to return a specific type, but mypy can't verify whether it's actually returning that type or not -- it can only infer a...
X Description: Mypy's --warn-return-any check flags when a function is declared to return a specific type, but mypy can't verify whether it's actually returning that type or not -- it can ...
Opengraph URL: https://github.com/python/cpython/pull/107405
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ee372d31-9664-21fd-403c-d7f4f7e155ed |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E446:3346BC:2548B5:32AAD8:6969CB7B |
| html-safe-nonce | 31efa7de8add830269c410183b5b9f0af2f0b58c3727a494cd3ace7e2b6cf5fd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDQ2OjMzNDZCQzoyNTQ4QjU6MzJBQUQ4OjY5NjlDQjdCIiwidmlzaXRvcl9pZCI6IjgwNzY5NDg0NTAxNjgxMzA0MjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9bb06d97c3af5b224d197194e193be13aa401085ddea09b10bb3ce7d45f66919 |
| hovercard-subject-tag | pull_request:1454401694 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/107405/files |
| twitter:image | https://avatars.githubusercontent.com/u/66076021?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/66076021?s=400&v=4 |
| og:image:alt | Mypy's --warn-return-any check flags when a function is declared to return a specific type, but mypy can't verify whether it's actually returning that type or not -- it can only infer a... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width