[go: nahoru, domu]

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

ARXML: allow to specify non-base 10 integer numbers #281

Merged
merged 1 commit into from
Mar 2, 2021

Conversation

andlaus
Copy link
Member
@andlaus andlaus commented Feb 22, 2021

in essence, this means replacing int(my_string_value) by int(my_string_value, 0). For some reason, python does not recognize numbers that start with a 0 and continue with a digit as octal, but AUTOSAR does, so this needs to be handled as a special case.

note that with this patch, python's "0o" prefix for octal numbers is also recognized. As far as I know, AUTOSAR does not allow that, but as long as we properly recognize everything which AUTOSAR specifies, I don't see a big problem with that...

Andreas Lauser andreas.lauser@mbition.io, Mercedes-Benz AG on behalf of MBition GmbH.

Imprint

in essence, this means replacing `int(my_string_value)` by
`int(my_string_value, 0)`. For some reason python does not recognize
numbers that start with a 0 and continue with a digit as octal, but
AUTOSAR does, so this case needs to be handled as a special case.

Signed-off-by: Andreas Lauser <andreas.lauser@mbition.io>
Signed-off-by: Oliver Kopp <oliver.kopp@mbition.io>
@andlaus andlaus requested a review from eerimoq February 22, 2021 13:15
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 96.552% when pulling ca16382 on Daimler:arxml_non_decimal_encodings into 7786a1d on eerimoq:master.

@eerimoq eerimoq merged commit 2f66e18 into cantools:master Mar 2, 2021
@andlaus andlaus deleted the arxml_non_decimal_encodings branch December 11, 2021 08:10
VonSquiggles pushed a commit to VonSquiggles/cantools that referenced this pull request May 13, 2022
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.

None yet

3 participants