Title: False negatives with `dict.__(r)or__` · Issue #10678 · python/typeshed · GitHub
Open Graph Title: False negatives with `dict.__(r)or__` · Issue #10678 · python/typeshed
X Title: False negatives with `dict.__(r)or__` · Issue #10678 · python/typeshed
Description: I have code equivalent to the following: from requests.structures import CaseInsensitiveDict CaseInsensitiveDict() | dict() mypy does not error. My environment has: mypy==1.5.1 types-requests==2.31.0.2 Python 3.11.5 At runtime I get: Typ...
Open Graph Description: I have code equivalent to the following: from requests.structures import CaseInsensitiveDict CaseInsensitiveDict() | dict() mypy does not error. My environment has: mypy==1.5.1 types-requests==2.31...
X Description: I have code equivalent to the following: from requests.structures import CaseInsensitiveDict CaseInsensitiveDict() | dict() mypy does not error. My environment has: mypy==1.5.1 types-requests==2.31...
Opengraph URL: https://github.com/python/typeshed/issues/10678
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"False negatives with `dict.__(r)or__`","articleBody":"I have code equivalent to the following:\r\n\r\n```python\r\nfrom requests.structures import CaseInsensitiveDict\r\n\r\nCaseInsensitiveDict() | dict()\r\n```\r\n\r\n`mypy` does not error.\r\n\r\nMy environment has:\r\n\r\n* `mypy==1.5.1`\r\n* `types-requests==2.31.0.2`\r\n* Python 3.11.5\r\n\r\nAt runtime I get:\r\n\r\n```\r\nTypeError: unsupported operand type(s) for |: 'CaseInsensitiveDict' and 'dict'\r\n```\r\n\r\nI would expect an `[operator]` error. For example, if I swap the `CaseInsensitiveDict()` for `1`, I get:\r\n\r\n```\r\nerror: Unsupported operand types for | (\"int\" and \"dict[str, str]\") [operator]\r\n```\r\n\r\nI am happy to contribute, but I'm not sure what change is needed. I imagine a change is needed in https://github.com/python/typeshed/blob/main/stubs/requests/requests/structures.pyi.","author":{"url":"https://github.com/adamtheturtle","@type":"Person","name":"adamtheturtle"},"datePublished":"2023-09-07T10:46:28Z","url":"https://github.com/python/typeshed/issues/10678"}
| 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:b9334e4e-be2d-21fa-4210-43534240457a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CF30:07D0:17F21CE:1FA4259:6B002936 |
| html-safe-nonce | dfeb7713af917a1693077bea5f08ab7f45993ee3327204db2851d8c6fe5dc4bd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRjMwOjA3RDA6MTdGMjFDRToxRkE0MjU5OjZCMDAyOTM2IiwidmlzaXRvcl9pZCI6IjY4NjQyODkyNDk0NjY4ODMxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6731c58e2b08a16677a5db7a55dea74cdc466bcf74da299857bf9acb22cf0e9d |
| hovercard-subject-tag | issue:1885641486 |
| 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/typeshed/10678/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7f4b9928eeb4a58ea0cbafad2307ae9567b96b240c2fba4ae875720d1617d9cd/python/typeshed/issues/10678 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7f4b9928eeb4a58ea0cbafad2307ae9567b96b240c2fba4ae875720d1617d9cd/python/typeshed/issues/10678 |
| og:image:alt | I have code equivalent to the following: from requests.structures import CaseInsensitiveDict CaseInsensitiveDict() | dict() mypy does not error. My environment has: mypy==1.5.1 types-requests==2.31... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | adamtheturtle |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| 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