Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mypyc] Support the u8 native integer type #15564

Merged
merged 16 commits into from
Jul 6, 2023
Merged

[mypyc] Support the u8 native integer type #15564

merged 16 commits into from
Jul 6, 2023

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Jul 1, 2023

This is mostly similar to i16 that I added recently in #15464, but there are some
differences:

  • Some adjustments were needed to support unsigned integers
  • Add overflow checking of literals, since it's easy to over/underflow when using u8 due to limited range
  • Rename primitive integer types from int16 to i16 (etc.) to match the user-visible types (needed to get some error messages consistent, and it's generally nicer)
  • Overall make things a bit more consistent
  • Actually update mypy_extensions stubs

This is an unsigned type to make it easier to work with binary/bytes data. The item values for bytes are unsigned 8-bit values, in particular. This type will become much more useful once we support packed arrays.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 4, 2023

Diff from mypy_primer, showing the effect of this PR on open source code:

vision (https://github.com/pytorch/vision): typechecking got 1.37x faster (43.0s -> 31.5s)
(Performance measurements are based on a single noisy sample)

@JukkaL JukkaL merged commit 8c70e80 into master Jul 6, 2023
@JukkaL JukkaL deleted the mypyc-u8 branch July 6, 2023 17:09
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