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

Small bug in makeunicodedata.py #96019

Closed
cfbolz opened this issue Aug 16, 2022 · 1 comment
Closed

Small bug in makeunicodedata.py #96019

cfbolz opened this issue Aug 16, 2022 · 1 comment
Labels
type-bug An unexpected behavior, bug, or error

Comments

@cfbolz
Copy link
Contributor

cfbolz commented Aug 16, 2022

I was reading makeunicodedata.py and found a small issue that leads to a bit of wasted space in the unicodedata module. This code:

                try:
                    i = decomp_data.index(decomp)
                except ValueError:
                    i = len(decomp_data)
                    decomp_data.extend(decomp)
                    decomp_size = decomp_size + len(decomp) * 2

will always take the exception path because both decomp_data and decomp are lists of ints, so the index call always raises. I think it was copy-pasted from some similar code a few lines up which however is about a lists of strings and a string, so it works there.

I will prepare a PR. The space saving isn't gigantic (about 4.5kib) but as it stands the code is confusing.

@isidentical
Copy link
Sponsor Member

Fixed by #96020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants