Title: strict_optional=False makes checking scripts using xarray to fail · Issue #9437 · python/mypy · GitHub
Open Graph Title: strict_optional=False makes checking scripts using xarray to fail · Issue #9437 · python/mypy
X Title: strict_optional=False makes checking scripts using xarray to fail · Issue #9437 · python/mypy
Description: 🐛 Bug Report When using mypy with strict_optional = False in the config file or using the --no-strict-optional flag in the terminal to check a file using the xarray package, it fails with an scary INTERNAL ERROR message. This might be a ...
Open Graph Description: 🐛 Bug Report When using mypy with strict_optional = False in the config file or using the --no-strict-optional flag in the terminal to check a file using the xarray package, it fails with an scary ...
X Description: 🐛 Bug Report When using mypy with strict_optional = False in the config file or using the --no-strict-optional flag in the terminal to check a file using the xarray package, it fails with an scary ...
Opengraph URL: https://github.com/python/mypy/issues/9437
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"strict_optional=False makes checking scripts using xarray to fail","articleBody":"## 🐛 Bug Report\r\n\r\nWhen using mypy with `strict_optional = False` in the config file or using the `--no-strict-optional` flag in the terminal to check a file using the `xarray` package, it fails with an scary INTERNAL ERROR message.\r\n\r\nThis might be a bug better suited for the `xarray` team, but thought to check with you first.\r\n\r\n## To Reproduce\r\n\r\nWrite a python script just importing `xarray`:\r\n\r\n```python\r\nimport xarray as xr\r\n```\r\n\r\nAnd check it with mypy using `mypy --no-strict-optional script.py`\r\n\r\n## Expected Behavior\r\n\r\nEverything works fine and I get: `Success: no issues found in 1 source file` . This is indeed the behavior if the `--no-strict-optional` flag is NOT used.\r\n\r\n## Actual Behavior\r\n\r\nI get the following output (personal info replaced by XXXXX):\r\n\r\n```\r\n/XXXXX/venv/lib/python3.7/site-packages/xarray/core/dataarray.py:2001: error: INTERNAL ERROR -- Please try using mypy master on Github:\r\nhttps://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build\r\nIf this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues\r\nversion: 0.782\r\n/XXXXX/venv/lib/python3.7/site-packages/xarray/core/dataarray.py:2001: : note: please use --show-traceback to print a traceback when reporting a bug\r\n```\r\n\r\nI've tried also the development version of mypy, as sugested, with identical results, and also used the `--show-traceback` option, with results in:\r\n\r\n```\r\n/XXXXX/venv/lib/python3.7/site-packages/xarray/core/dataarray.py:2001: error: INTERNAL ERROR -- Please try using mypy master on Github:\r\nhttps://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build\r\nPlease report a bug at https://github.com/python/mypy/issues\r\nversion: 0.782\r\nTraceback (most recent call last):\r\n File \"mypy/checker.py\", line 401, in accept\r\n File \"mypy/nodes.py\", line 1129, in accept\r\n File \"mypy/checker.py\", line 3437, in visit_for_stmt\r\n File \"mypy/checker.py\", line 3470, in analyze_iterable_item_type\r\n File \"mypy/checkexpr.py\", line 2345, in check_method_call_by_name\r\n File \"mypy/checkmember.py\", line 126, in analyze_member_access\r\n File \"mypy/checkmember.py\", line 143, in _analyze_member_access\r\n File \"mypy/checkmember.py\", line 225, in analyze_instance_member_access\r\n File \"mypy/checkmember.py\", line 376, in analyze_member_var_access\r\n File \"mypy/checkmember.py\", line 578, in analyze_var\r\n File \"mypy/meet.py\", line 50, in meet_types\r\n File \"mypy/types.py\", line 794, in accept\r\n File \"mypy/meet.py\", line 497, in visit_instance\r\n File \"mypy/meet.py\", line 647, in meet\r\n File \"mypy/meet.py\", line 50, in meet_types\r\n File \"mypy/types.py\", line 1347, in accept\r\n File \"mypy/meet.py\", line 584, in visit_tuple_type\r\n File \"mypy/typeops.py\", line 44, in tuple_fallback\r\n File \"mypy/join.py\", line 531, in join_type_list\r\n File \"mypy/join.py\", line 105, in join_types\r\n File \"mypy/types.py\", line 794, in accept\r\n File \"mypy/join.py\", line 158, in visit_instance\r\n File \"mypy/join.py\", line 371, in join_instances\r\n File \"mypy/subtypes.py\", line 143, in is_subtype_ignoring_tvars\r\n File \"mypy/subtypes.py\", line 93, in is_subtype\r\n File \"mypy/subtypes.py\", line 135, in _is_subtype\r\n File \"mypy/types.py\", line 794, in accept\r\n File \"mypy/subtypes.py\", line 259, in visit_instance\r\n File \"mypy/subtypes.py\", line 541, in is_protocol_implementation\r\n File \"mypy/subtypes.py\", line 93, in is_subtype\r\n File \"mypy/subtypes.py\", line 135, in _is_subtype\r\n File \"mypy/types.py\", line 1786, in accept\r\n File \"mypy/subtypes.py\", line 459, in visit_partial_type\r\nRuntimeError: \r\n/XXXXX/venv/lib/python3.7/site-packages/xarray/core/dataarray.py:2001: : note: use --pdb to drop into pdb\r\n```\r\n\r\n## Your Environment\r\n\r\n- Mypy version used: 0.782\r\n- xarray version: 0.16.0\r\n- Mypy command-line flags: `--no-strict-optional`\r\n- Mypy configuration options from `mypy.ini` (and other config files): `strict_optional = False` has the same effect.\r\n- Python version used: 3.7.4\r\n- Operating system and version: Mac OS Catalina 10.15.6","author":{"url":"https://github.com/dalonsoa","@type":"Person","name":"dalonsoa"},"datePublished":"2020-09-11T08:15:45Z","url":"https://github.com/python/mypy/issues/9437"}
| 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:567bd813-f4ba-3678-42d3-7a467bab2fea |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D138:07D0:1B4436E:240E19F:6B003838 |
| html-safe-nonce | 79cb7450bd1c5e7afbc907f5bdeab1044c1fe22dedfe12ca159436031c424a66 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTM4OjA3RDA6MUI0NDM2RToyNDBFMTlGOjZCMDAzODM4IiwidmlzaXRvcl9pZCI6IjU0NzcxOTM3NTUxMDQ2NTU0MTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fe026f8ac2a9548e4cbe240782f30462ad58557504ad31621336c4acb9967f69 |
| hovercard-subject-tag | issue:699005330 |
| 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/9437/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d79544c5dfcfc365a3eff986b46c0867fcd7db8dce94001eed84d24a75572a55/python/mypy/issues/9437 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d79544c5dfcfc365a3eff986b46c0867fcd7db8dce94001eed84d24a75572a55/python/mypy/issues/9437 |
| og:image:alt | 🐛 Bug Report When using mypy with strict_optional = False in the config file or using the --no-strict-optional flag in the terminal to check a file using the xarray package, it fails with an scary ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dalonsoa |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width