Skip to content

[mypyc] Enable --strict-bytes by default in mypyc (and require it)#20548

Merged
JukkaL merged 8 commits into
masterfrom
mypyc-strict-bytes
Jan 8, 2026
Merged

[mypyc] Enable --strict-bytes by default in mypyc (and require it)#20548
JukkaL merged 8 commits into
masterfrom
mypyc-strict-bytes

Conversation

@JukkaL

@JukkaL JukkaL commented Jan 8, 2026

Copy link
Copy Markdown
Collaborator

We'll be switching this on by default in mypy 2.0, but we can do it earlier in mypyc since backward compatibility requirements are not as strict. This makes the bytes primitive type not include bytearray any more. This allows more efficient primitives and makes the semantics more consistent.

I'll ensure that the bytes C primitives don't have dead bytearray code paths after this has been merged. I'll also add a separate bytearray primitive type at some point.

@github-actions

github-actions Bot commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@JukkaL JukkaL merged commit 78dcec5 into master Jan 8, 2026
24 checks passed
@JukkaL JukkaL deleted the mypyc-strict-bytes branch January 8, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants