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

Fix compilation on platforms that don't use i8 for c_char #1182

Merged
merged 2 commits into from Sep 14, 2020

Conversation

mtreinish
Copy link
Contributor

This commit changes the cast of an c_char to be a c_char type instead of
i8. On x86 platforms i8 == c_char, but it can also be u8 on other
platforms. [1][2] This should fix compilation on those platforms by just
using the c_char type so that we're casting as the right type regardless
of which platform PyO3 is being built for.

Fixes #1181

[1] https://doc.rust-lang.org/std/os/raw/type.c_char.html
[2] https://github.com/rust-lang/rust/blob/master/library/std/src/os/raw/mod.rs#L55-L99

This commit changes the cast of an c_char to be a c_char type instead of
i8. On x86 platforms i8 == c_char, but it can also be u8 on other
platforms. [1][2] This should fix compilation on those platforms by just
using the c_char type so that we're casting as the right type regardless
of which platform PyO3 is being built for.

Fixes PyO3#1181

[1] https://doc.rust-lang.org/std/os/raw/type.c_char.html
[2] https://github.com/rust-lang/rust/blob/master/library/std/src/os/raw/mod.rs#L55-L99
Copy link
Member

@kngwyu kngwyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks!

@davidhewitt
Copy link
Member

👍 thanks very much for debugging this, sorry for the bug I introduced!

@davidhewitt
Copy link
Member

If you have a moment, could you please add a changelog entry? Else I'll merge this sometime tomorrow and write a changelog entry at the same time.

@mtreinish
Copy link
Contributor Author

If you have a moment, could you please add a changelog entry? Else I'll merge this sometime tomorrow and write a changelog entry at the same time.

Ok sure, I added a changelog entry in: 7dea2a8

@davidhewitt
Copy link
Member

Many thanks!

@davidhewitt davidhewitt merged commit a0960f8 into PyO3:master Sep 14, 2020
@mtreinish mtreinish deleted the fix-non-x86-compile-error branch September 14, 2020 10:38
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.

0.12.0 non-x86 compile failure
3 participants