Bug#996783: deb822-repro: Paragraph iter yields <class 'debian._util._CaseInsensitiveString'> rather than strings

Niels Thykier niels at thykier.net
Mon Oct 18 19:15:07 BST 2021


Control: tags -1 moreinfo

Jelmer Vernooij:
> Package: python3-debian
> Version: 0.1.39
> Severity: normal
> 
> The new deb822 repro interface paragraph iterator yields objects of type
> debian._util._CaseInsensitiveString rather than strings.
> 
> This breaks e.g. checks that verify that the name of the field appears in a
> list of strings when there are non-lowercase field names:
> 
>>>> import debian._util
>>>> x = debian._util._CaseInsensitiveString('Oo')
>>>> x in set(['Oo'])
> False
> 
> [...]


Hi Jelmer,

This is correct and unfortunately I do not have a good solution for it.

It might be possible to return a "regular str" in this case, but the
behaviour would still fall a part for paragraphs with duplicate keys
where the keys are not even strings[1] (admittedly, they are a rarity
and you can filter those out by having the parse reject them).



Maybe we should reject paragraphs with duplicate keys by default to
side-step that issue?  What is your take on this?


Thanks,
~Niels


[1]: They cannot be regular strings as that would fail the:

"""
 for k in paragraphs.keys():
    v = paragraphs[k]
"""
(anti-)pattern.



More information about the pkg-python-debian-maint mailing list