Title: mypy RecursionError analyzing pint.facets.plain.quantity.PlainQuantity · Issue #21985 · python/mypy · GitHub
Open Graph Title: mypy RecursionError analyzing pint.facets.plain.quantity.PlainQuantity · Issue #21985 · python/mypy
X Title: mypy RecursionError analyzing pint.facets.plain.quantity.PlainQuantity · Issue #21985 · python/mypy
Description: Crash Report mypy crashes with RecursionError while analyzing pint (since pint==0.26.1). Reproduced with compiled and non-compiled mypy. Traceback ... skipping approx 50000 lines ... File "/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3...
Open Graph Description: Crash Report mypy crashes with RecursionError while analyzing pint (since pint==0.26.1). Reproduced with compiled and non-compiled mypy. Traceback ... skipping approx 50000 lines ... File "/home/qu...
X Description: Crash Report mypy crashes with RecursionError while analyzing pint (since pint==0.26.1). Reproduced with compiled and non-compiled mypy. Traceback ... skipping approx 50000 lines ... File "/ho...
Opengraph URL: https://github.com/python/mypy/issues/21985
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mypy RecursionError analyzing pint.facets.plain.quantity.PlainQuantity","articleBody":"**Crash Report**\n\n`mypy` crashes with `RecursionError` while analyzing `pint` (since `pint==0.26.1`). Reproduced with compiled and non-compiled mypy.\n\n**Traceback**\n\n```python-traceback\n... skipping approx 50000 lines ...\n File \"/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3.13/site-packages/mypy/type_visitor.py\", line 560, in visit_instance\n return self.query_types(t.args)\n ~~~~~~~~~~~~~~~~^^^^^^^^\n File \"/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3.13/site-packages/mypy/type_visitor.py\", line 628, in query_types\n return any(t.accept(self) for t in types)\n File \"/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3.13/site-packages/mypy/type_visitor.py\", line 628, in \u003cgenexpr>\n return any(t.accept(self) for t in types)\n ~~~~~~~~^^^^^^\n File \"/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3.13/site-packages/mypy/types.py\", line 1684, in accept\n return visitor.visit_instance(self)\n ~~~~~~~~~~~~~~~~~~~~~~^^^^^^\n File \"/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3.13/site-packages/mypy/type_visitor.py\", line 560, in visit_instance\n return self.query_types(t.args)\n ~~~~~~~~~~~~~~~~^^^^^^^^\n File \"/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3.13/site-packages/mypy/type_visitor.py\", line 628, in query_types\n return any(t.accept(self) for t in types)\n File \"/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3.13/site-packages/mypy/type_visitor.py\", line 628, in \u003cgenexpr>\n return any(t.accept(self) for t in types)\n ~~~~~~~~^^^^^^\n File \"/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3.13/site-packages/mypy/types.py\", line 1684, in accept\n return visitor.visit_instance(self)\n ~~~~~~~~~~~~~~~~~~~~~~^^^^^^\n File \"/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3.13/site-packages/mypy/type_visitor.py\", line 560, in visit_instance\n return self.query_types(t.args)\n ~~~~~~~~~~~~~~~~^^^^^^^^\n File \"/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3.13/site-packages/mypy/type_visitor.py\", line 628, in query_types\n return any(t.accept(self) for t in types)\n File \"/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3.13/site-packages/mypy/type_visitor.py\", line 628, in \u003cgenexpr>\n return any(t.accept(self) for t in types)\n ~~~~~~~~^^^^^^\n File \"/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3.13/site-packages/mypy/types.py\", line 1684, in accept\n return visitor.visit_instance(self)\n ~~~~~~~~~~~~~~~~~~~~~~^^^^^^\nRecursionError: maximum recursion depth exceeded\n/home/quentin/dev/QSA/pint_0.x/.venv/lib/python3.13/site-packages/pint/facets/numpy/quantity.py:63: note: use --pdb to drop into pdb\nRecursionError: maximum recursion depth exceeded\n```\n\n**To Reproduce**\n\nI narrowed down the issue to this single import of `pint.facets.plain.quantity.PlainQuantity`.\nRun `mypy` on a file with this content:\n\n```python\nfrom pint.facets.plain.quantity import PlainQuantity\n```\n\n**Your Environment**\n\nIssue appears since version `0.26` of `pint` when they introduced massive type annotations for `PlainQuantity`. See https://github.com/hgrecco/pint/pull/2302 and https://github.com/hgrecco/pint/pull/2303\n\n- Mypy version used: `2.3.1` and `1.9.1`\n- Mypy command-line flags: none\n- Mypy configuration options from `mypy.ini` (and other config files): none\n- Python version used: `3.13.12`\n- Operating system and version: Fedora 43 in WSL2\n\n\n","author":{"url":"https://github.com/quentin","@type":"Person","name":"quentin"},"datePublished":"2026-09-15T07:35:55Z","url":"https://github.com/python/mypy/issues/21985"}
| 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:ce76de30-f710-3749-39cf-61a1ff1c4906 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D676:B1603:2E97CAF:3D90283:6B0023F5 |
| html-safe-nonce | ec536ea9e565274e4214420373160c99c811f4042798eb05a6b2e7cc510529bb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjc2OkIxNjAzOjJFOTdDQUY6M0Q5MDI4Mzo2QjAwMjNGNSIsInZpc2l0b3JfaWQiOiI3NjM0OTY0OTYyMTc1MDk5ODkzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 921185a14af4c03e3bed18aff3606a344a2ce664950911840333b1ed642ef023 |
| hovercard-subject-tag | issue:5459017650 |
| 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/21985/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4a6d08054c8e303504ee050ebbb4cf8875e8446041fb0465fe09c9be02a1352b/python/mypy/issues/21985 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4a6d08054c8e303504ee050ebbb4cf8875e8446041fb0465fe09c9be02a1352b/python/mypy/issues/21985 |
| og:image:alt | Crash Report mypy crashes with RecursionError while analyzing pint (since pint==0.26.1). Reproduced with compiled and non-compiled mypy. Traceback ... skipping approx 50000 lines ... File "/home/qu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | quentin |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width