Merged
Conversation
Member
|
@qingshi163 would you review this PR please? |
Contributor
|
Seem like a problem if we want to pack a float but give a int. |
qingshi163
reviewed
Oct 26, 2020
Comment on lines
+557
to
+569
| make_pack_with_endianess!(i64, get_int_or_index); | ||
| make_pack_with_endianess!(u64, get_int_or_index); | ||
| make_pack_with_endianess!(f32, TryFromObject::try_from_object); | ||
| make_pack_with_endianess!(f64, TryFromObject::try_from_object); | ||
|
|
Contributor
There was a problem hiding this comment.
CPython allows pack float format with int, float or class with float() but not a float like string. Non of our function doing exactly the job. We may need one it also can be use by array.array
Member
Author
There was a problem hiding this comment.
I think IntoPyFloat::try_from_object is correct; it accepts float, int, or anything with a __float__ method
Member
Author
There was a problem hiding this comment.
I modified it in #2309 to not accept a float string, since that's what PyFloat_AsDouble does
d601242 to
026f396
Compare
youknowone
approved these changes
Oct 27, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is sort of a big lump change, and there aren't necessarily tests to prove it, since there aren't any tests in
test_struct.pythat verify the native ordering -- even though there's padding now and correct alignment/size, the tests that I unskipped aren't related to that 😞 . Still, I think this is cleaner then it was before; there's an enum for the codes now, and finding thepack()function for a code is a bit cleaner now and respects endianness/architecture