Title: Replace builtins.function with types.FunctionType · Issue #3171 · python/mypy · GitHub
Open Graph Title: Replace builtins.function with types.FunctionType · Issue #3171 · python/mypy
X Title: Replace builtins.function with types.FunctionType · Issue #3171 · python/mypy
Description: Copied from #3107 It seems that with this change, every test needs types.FunctionType in the test stubs (probably because builtins.function was used as a fallback). And that means builtins.pyi (and every custom bultins fixture) would hav...
Open Graph Description: Copied from #3107 It seems that with this change, every test needs types.FunctionType in the test stubs (probably because builtins.function was used as a fallback). And that means builtins.pyi (and...
X Description: Copied from #3107 It seems that with this change, every test needs types.FunctionType in the test stubs (probably because builtins.function was used as a fallback). And that means builtins.pyi (and...
Opengraph URL: https://github.com/python/mypy/issues/3171
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Replace builtins.function with types.FunctionType","articleBody":"Copied from #3107 \r\n\r\nIt seems that with this change, every test needs types.FunctionType in the test stubs (probably because builtins.function was used as a fallback). And that means builtins.pyi (and every custom bultins fixture) would have to import types. (On top of that, we'll also need to define list everywhere since types.pyi uses it.)\r\n\r\nDo we want to do some workaround, like manually inject types.FunctionType into the test environment, without importing types? Not that types.pyi is huge, but it does have a generic in it.\r\n\r\n@ilevkivskyi \r\n> You could just try adding import types, and see what is the performance impact for tests, if it is few percent, then it is OK, but a manual injection would be needed if there will be a significant slow-down in tests.\r\n\r\nThere's an issue with importing `types` module everywhere; it breaks a lot of tests due to the presence of `TypeVar` in it, and therefore the requirement to bring in `typing` as well. In particular, it breaks incremental tests, tests that use `[file builtins.py]` (even after I added `import types` to all fixtures). Also fixing `ThirdPass.builtin_type` to make it work for `types.FunctionType` would be quite hacky.\r\n\r\nI am now thinking that maybe we should not replace all `builtins.function` after all. If we want the user to be able to use `types.FunctionType`, that's ok, but perhaps internally it's not worth changing?","author":{"url":"https://github.com/pkch","@type":"Person","name":"pkch"},"datePublished":"2017-04-14T04:07:22Z","url":"https://github.com/python/mypy/issues/3171"}
| 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:526a211f-a910-1506-b5ce-028dd6256cf7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9DEE:17415E:120F73:19064B:6B0063F9 |
| html-safe-nonce | 97a0a6c5c7ed7fd15c0875e67146285d1ba2190802576d66023d2a7d527d163b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REVFOjE3NDE1RToxMjBGNzM6MTkwNjRCOjZCMDA2M0Y5IiwidmlzaXRvcl9pZCI6IjMzNzE0NzA4MjE0NDc5ODQxMjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4b097b4c4820fa106bea4b410331489cb7699ca281ebc1cf36a1355af5398f4a |
| hovercard-subject-tag | issue:221737461 |
| 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/3171/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4c918f57adbf2283bd28418ae86872d28e2ad1489561c93d98b6b70a6dbdbc54/python/mypy/issues/3171 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4c918f57adbf2283bd28418ae86872d28e2ad1489561c93d98b6b70a6dbdbc54/python/mypy/issues/3171 |
| og:image:alt | Copied from #3107 It seems that with this change, every test needs types.FunctionType in the test stubs (probably because builtins.function was used as a fallback). And that means builtins.pyi (and... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pkch |
| hostname | github.com |
| expected-hostname | github.com |
| None | 25854482a1773a7c1ebb8be3d2bc1c6e61d82d78126be63b5044474a86d44d9e |
| 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 | e4f5c239e31f1f680e6bbc419ff92d774da616ec |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width