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

ISBN10 calculating checksum before any controls #171

Closed
canklot opened this issue Sep 21, 2022 · 0 comments
Closed

ISBN10 calculating checksum before any controls #171

canklot opened this issue Sep 21, 2022 · 0 comments
Labels

Comments

@canklot
Copy link
Contributor

canklot commented Sep 21, 2022

When calling ISBN10 with a text that contains any letters, the function crashes at _calculate_checksum.

Exception Type: ValueError
invalid literal for int() with base 10: 'a'
barcode\isxn.py, line 77, in <genexpr>
python.exe
3.7.9
canklot added a commit to canklot/python-barcode that referenced this issue Sep 21, 2022
Moved `super().__init__` before calling `_calculate_checksum()` to check if the string contains any letters to prevent value errors that can happen when calculating checksum. I tested the new version with the input `0132354187` and the produced barcode before and after the commit is the same  as `9780132352`.
canklot added a commit to canklot/python-barcode that referenced this issue Sep 21, 2022
Fix issue WhyNotHugo#171 calculating checksum before any controls
@WhyNotHugo WhyNotHugo added the bug label Sep 21, 2022
WhyNotHugo pushed a commit that referenced this issue Sep 21, 2022
Moved `super().__init__` before calling `_calculate_checksum()` to check if the string contains any letters to prevent value errors that can happen when calculating checksum. I tested the new version with the input `0132354187` and the produced barcode before and after the commit is the same  as `9780132352`.
@canklot canklot closed this as completed Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants