Title: Add --strict-bytes flag to disable promotions to bytes · Issue #18256 · python/mypy · GitHub
Open Graph Title: Add --strict-bytes flag to disable promotions to bytes · Issue #18256 · python/mypy
X Title: Add --strict-bytes flag to disable promotions to bytes · Issue #18256 · python/mypy
Description: Feature We currently have the undocumented flags --disable-bytearray-promotion and --disable-memoryview-promotion that turn off promotions from bytearray/memoryview to bytes. These are a bit unwieldy, and I'm proposing that we add a new ...
Open Graph Description: Feature We currently have the undocumented flags --disable-bytearray-promotion and --disable-memoryview-promotion that turn off promotions from bytearray/memoryview to bytes. These are a bit unwiel...
X Description: Feature We currently have the undocumented flags --disable-bytearray-promotion and --disable-memoryview-promotion that turn off promotions from bytearray/memoryview to bytes. These are a bit unwiel...
Opengraph URL: https://github.com/python/mypy/issues/18256
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add --strict-bytes flag to disable promotions to bytes","articleBody":"**Feature**\r\n\r\nWe currently have the undocumented flags `--disable-bytearray-promotion` and `--disable-memoryview-promotion` that turn off promotions from `bytearray`/`memoryview` to `bytes`. These are a bit unwieldy, and I'm proposing that we add a new flag called `--strict-bytes` that enables both of these flags, and make it an officially documented feature. In mypy 2.0 we'd switch `--strict-bytes` on by default.\r\n\r\nAdditional details:\r\n * This should be documented.\r\n * Also support `--no-strict-bytes` for the inverse. This allows users to prepare for mypy 2.0 even if they aren't ready to turn on the flag.\r\n * This probably shouldn't be a per-module option, since migration to the new behavior appears to be fairly easy even for large codebases.\r\n * We'll still keep the old undocumented flags for now, but they might be removed in the future.\r\n\r\n**Pitch**\r\n\r\nCurrently `bytearray` and `memoryview` are assignable to `bytes`, which is incorrect, but this has been tricky to fix mostly due to stub quality. Stubs seem to have improved enough for this to be practical now -- any anyway switching the default would give more incentives to fix stubs.\r\n\r\nThe new flag is shorter and easier to remember, and it combines both of the features so it's simpler. The naming is also arguably consistent with `--strict-equality` and friends. In my experience dropping the `memoryview` promotion rarely causes trouble, so having it as a separate flag doesn't seem important.","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2024-12-06T13:01:26Z","url":"https://github.com/python/mypy/issues/18256"}
| 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:04246bd1-508c-c2bb-660c-27431f478a05 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F4C:17F252:2E2660:3ED772:6B006A53 |
| html-safe-nonce | 2ca24984dc39ddbf7f58f324b4ebc316f483ff307042d1c10deba38adaa58e05 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjRDOjE3RjI1MjoyRTI2NjA6M0VENzcyOjZCMDA2QTUzIiwidmlzaXRvcl9pZCI6IjYxNzYxMzM5MTI2NzEyOTkzOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ba1c6c233692792f5caa66e28ad8c69e4648d266b5a7f5b1e3d94c2455ef95a2 |
| hovercard-subject-tag | issue:2723010876 |
| 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/18256/issue_layout |
| twitter:image | https://opengraph.githubassets.com/480d4f047fc1a9755a86c4f5ab5b5156755d0961b4e6a1a55ad8a1ebe54fec3a/python/mypy/issues/18256 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/480d4f047fc1a9755a86c4f5ab5b5156755d0961b4e6a1a55ad8a1ebe54fec3a/python/mypy/issues/18256 |
| og:image:alt | Feature We currently have the undocumented flags --disable-bytearray-promotion and --disable-memoryview-promotion that turn off promotions from bytearray/memoryview to bytes. These are a bit unwiel... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JukkaL |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6527e91c60c0b29d16606ff32ac5df8ecdc37a2a62205ea057a14d7762c870fa |
| 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 | 46f1cd2ae3cd8ae1a81019b5d619742e76f13bbd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width