Title: Bytes formatting error gets produced during failed overload match · Issue #12665 · python/mypy · GitHub
Open Graph Title: Bytes formatting error gets produced during failed overload match · Issue #12665 · python/mypy
X Title: Bytes formatting error gets produced during failed overload match · Issue #12665 · python/mypy
Description: Bug Report On Python 3 formatting "b'abc'" with "{}" produces "b'abc'", not "abc" gets produced during bidirectional inference in a failed overload match. To Reproduce from typing import overload, Callable @overload def sub(pattern: str,...
Open Graph Description: Bug Report On Python 3 formatting "b'abc'" with "{}" produces "b'abc'", not "abc" gets produced during bidirectional inference in a failed overload match. To Reproduce from typing import overload, ...
X Description: Bug Report On Python 3 formatting "b'abc'" with "{}" produces "b'abc'", not "abc" gets produced during bidirectional inference in a failed ov...
Opengraph URL: https://github.com/python/mypy/issues/12665
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bytes formatting error gets produced during failed overload match","articleBody":"**Bug Report**\r\n\r\n`On Python 3 formatting \"b'abc'\" with \"{}\" produces \"b'abc'\", not \"abc\"` gets produced during bidirectional inference in a failed overload match.\r\n\r\n**To Reproduce**\r\n\r\n```python\r\nfrom typing import overload, Callable\r\n\r\n@overload\r\ndef sub(pattern: str, repl: Callable[[str], str]) -> str: ...\r\n@overload\r\ndef sub(pattern: bytes, repl: Callable[[bytes], bytes]) -> bytes: ...\r\ndef sub(pattern: object, repl: object) -> object:\r\n raise NotImplementedError\r\n\r\ndef better_snakecase(text: str) -> str:\r\n text = sub(r\"([A-Z])([A-Z]+)([A-Z](?:[^A-Z]|$))\", lambda match: f\"{match}\")\r\n return text\r\n```\r\n\r\n**Expected Behavior**\r\n\r\nNo errors\r\n\r\n**Actual Behavior**\r\n\r\n```\r\ntest_cases/stdlib/typing/pattern.py:11: error: On Python 3 formatting \"b'abc'\" with \"{}\" produces \"b'abc'\", not \"abc\"; use \"{!r}\" if this is desired behavior\r\n```\r\n\r\n**Your Environment**\r\n\r\n- Mypy version used: master, 0.942\r\n- Mypy command-line flags: none\r\n\r\n---\r\n\r\nFound in python/typeshed#7679, the repro case minified from some code in homeassistant.","author":{"url":"https://github.com/JelleZijlstra","@type":"Person","name":"JelleZijlstra"},"datePublished":"2022-04-24T01:24:59Z","url":"https://github.com/python/mypy/issues/12665"}
| 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:c35880b9-8b34-9336-46ea-ee0b75f28c63 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F88:34D604:19662C4:218FD47:6B002AB0 |
| html-safe-nonce | 09f3b99fcfde97e08fa2846af293e927dab900e1f0e791ece35f9de32458544d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Rjg4OjM0RDYwNDoxOTY2MkM0OjIxOEZENDc6NkIwMDJBQjAiLCJ2aXNpdG9yX2lkIjoiMTk5MDg0NjA5MzcyNTgwNTIzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7ea6f58feebcb1a8eafc341f10a3c6a98aeae4ba82efe9838a258b64bba44f9f |
| hovercard-subject-tag | issue:1213496175 |
| 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/12665/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a7a2be81f3c6d51f69c367c612233a247516a0e1c610110022a3f7f19e5f7c42/python/mypy/issues/12665 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a7a2be81f3c6d51f69c367c612233a247516a0e1c610110022a3f7f19e5f7c42/python/mypy/issues/12665 |
| og:image:alt | Bug Report On Python 3 formatting "b'abc'" with "{}" produces "b'abc'", not "abc" gets produced during bidirectional inference in a failed overload match. To Reproduce from typing import overload, ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JelleZijlstra |
| 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