Title: [1.11 regression] Infinite recursion with callables and follow imports skip · Issue #17954 · python/mypy · GitHub
Open Graph Title: [1.11 regression] Infinite recursion with callables and follow imports skip · Issue #17954 · python/mypy
X Title: [1.11 regression] Infinite recursion with callables and follow imports skip · Issue #17954 · python/mypy
Description: With pydantic_core installed, the following file: from typing import Callable from pydantic_core import core_schema Recurse = Callable[[core_schema.CoreSchema, 'Walk'], core_schema.CoreSchema] Walk = Callable[[core_schema.CoreSchema, Rec...
Open Graph Description: With pydantic_core installed, the following file: from typing import Callable from pydantic_core import core_schema Recurse = Callable[[core_schema.CoreSchema, 'Walk'], core_schema.CoreSchema] Walk...
X Description: With pydantic_core installed, the following file: from typing import Callable from pydantic_core import core_schema Recurse = Callable[[core_schema.CoreSchema, 'Walk'], core_schema.CoreSche...
Opengraph URL: https://github.com/python/mypy/issues/17954
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[1.11 regression] Infinite recursion with callables and follow imports skip","articleBody":"With `pydantic_core` installed, the following file:\r\n\r\n```python\r\nfrom typing import Callable\r\n\r\nfrom pydantic_core import core_schema\r\n\r\nRecurse = Callable[[core_schema.CoreSchema, 'Walk'], core_schema.CoreSchema]\r\nWalk = Callable[[core_schema.CoreSchema, Recurse], core_schema.CoreSchema]\r\n```\r\n\r\nResults in a segmentation fault on compiled version.\r\n\r\nThe end of the traceback using interpreted from `master`:\r\n\r\n```python\r\n ...\r\n File \"/fakepath/lib/python3.12/site-packages/mypy/typetraverser.py\", line 85, in visit_callable_type\r\n self.traverse_types(t.arg_types)\r\n File \"/fakepath/lib/python3.12/site-packages/mypy/typetraverser.py\", line 148, in traverse_types\r\n typ.accept(self)\r\n File \"/fakepath/lib/python3.12/site-packages/mypy/types.py\", line 410, in accept\r\n return visitor.visit_type_alias_type(self)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/fakepath/lib/python3.12/site-packages/mypy/messages.py\", line 2754, in visit_type_alias_type\r\n get_proper_type(t).accept(self)\r\n ^^^^^^^^^^^^^^^^^^\r\n File \"/fakepath/lib/python3.12/site-packages/mypy/types.py\", line 3185, in get_proper_type\r\n typ = typ._expand_once()\r\n ^^^^^^^^^^^^^^^^^^\r\n File \"/fakepath/lib/python3.12/site-packages/mypy/types.py\", line 352, in _expand_once\r\n new_tp = self.alias.target.accept(InstantiateAliasVisitor(mapping))\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/fakepath/lib/python3.12/site-packages/mypy/types.py\", line 2018, in accept\r\n return visitor.visit_callable_type(self)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/fakepath/lib/python3.12/site-packages/mypy/expandtype.py\", line 409, in visit_callable_type\r\n arg_types = self.expand_types(t.arg_types)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/fakepath/lib/python3.12/site-packages/mypy/expandtype.py\", line 515, in expand_types\r\n a.append(t.accept(self))\r\n ^^^^^^^^^^^^^^\r\n File \"/fakepath/lib/python3.12/site-packages/mypy/types.py\", line 410, in accept\r\n return visitor.visit_type_alias_type(self)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/fakepath/lib/python3.12/site-packages/mypy/expandtype.py\", line 510, in visit_type_alias_type\r\n return t.copy_modified(args=args)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/fakepath/lib/python3.12/site-packages/mypy/types.py\", line 443, in copy_modified\r\n return TypeAliasType(\r\n ^^^^^^^^^^^^^^\r\n File \"/fakepath/lib/python3.12/site-packages/mypy/types.py\", line 318, in __init__\r\nRecursionError: maximum recursion depth exceeded\r\n```\r\n\r\n**Your Environment**\r\n\r\n\u003c!-- Include as many relevant details about the environment you experienced the bug in -->\r\n\r\n- Mypy version used: 1.11.0 through 1.12.0\r\n- Python version used: 3.12\r\n- Mypy command: `mypy t.py --config-file mypy.ini`\r\n- Operating system and version: Ubuntu\r\n\r\nConfig file (the two config values are necessary to reproduce):\r\n\r\n```ini\r\n[mypy]\r\ndisallow_any_unimported = True\r\n\r\n[mypy-pydantic_core.*]\r\nfollow_imports = skip\r\n```\r\n","author":{"url":"https://github.com/Viicos","@type":"Person","name":"Viicos"},"datePublished":"2024-10-15T07:42:47Z","url":"https://github.com/python/mypy/issues/17954"}
| 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:218f5c74-753c-74c7-cc9d-cdd61296f098 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D2E:3AC034:BF193B:101931A:6B004FF2 |
| html-safe-nonce | 9fa74738318d10d9f58ab59faef2c3ea6bd0878f8ebbac76b8f052db31ce666b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDJFOjNBQzAzNDpCRjE5M0I6MTAxOTMxQTo2QjAwNEZGMiIsInZpc2l0b3JfaWQiOiI1OTA0OTQ2NDE4NzQ0ODQwMTc4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d7d14b1c6d15e06d527b45d2bb5d95c8cef9da50920e4ca9bdd63d4dc8f159e8 |
| hovercard-subject-tag | issue:2587924123 |
| 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/17954/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9020a231c2649505a42bdf0c82b13af676aa64185c6718db1c5bfa025a46fe64/python/mypy/issues/17954 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9020a231c2649505a42bdf0c82b13af676aa64185c6718db1c5bfa025a46fe64/python/mypy/issues/17954 |
| og:image:alt | With pydantic_core installed, the following file: from typing import Callable from pydantic_core import core_schema Recurse = Callable[[core_schema.CoreSchema, 'Walk'], core_schema.CoreSchema] Walk... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Viicos |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width