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 i16 native integer type #15464

Merged
merged 22 commits into from
Jun 23, 2023
Merged

[mypyc] Support the i16 native integer type #15464

merged 22 commits into from
Jun 23, 2023

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Jun 19, 2023

The i16 type behaves the same as i64 and i32, but is obviously smaller. The PR is big, but it's mostly because of test cases, which are adapted from i32 test cases.

Also fix error handling in unboxing of native int and float types (i.e. all types with overlapping error values).

@github-actions
Copy link
Contributor

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

@JukkaL JukkaL merged commit c239369 into master Jun 23, 2023
@JukkaL JukkaL deleted the mypyc-i16 branch June 23, 2023 17:20
JukkaL added a commit that referenced this pull request Jun 24, 2023
Two recent mypyc PRs didn't work together (#15470 and #15464). Fix
them.
JukkaL added a commit that referenced this pull request Jun 25, 2023
Two recent mypyc PRs didn't work together (#15470 and #15464). Fix them.
JukkaL added a commit that referenced this pull request Jul 6, 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.

---------

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
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.

2 participants