Content-Length: 266546 | pFad | https://github.com/python/cpython/issues/96019

ad Small bug in makeunicodedata.py · Issue #96019 · python/cpython · GitHub
Skip to content

Small bug in makeunicodedata.py #96019

Description

@cfbolz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/96019

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy