This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients eryksun, larry, loewis, paul.moore, r.david.murray, steve.dower, tim.golden, tzickel, zach.ware
Date 2021-02-25.15:11:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1614265861.98.0.181685468733.issue28824@roundup.psfhosted.org>
In-reply-to
Content
In Windows, maybe the os.environ mapping could use a case-insensitive subclass of str for its keys, such as the following:

    @total_ordering
    class _CaseInsensitiveString(str):
        def __eq__(self, other):
            if not isinstance(other, str):
                return NotImplemented
            return self.upper() == other.upper()

        def __lt__(self, other):
            if not isinstance(other, str):
                return NotImplemented
            return self.upper() < other.upper()

        def __hash__(self):
            return hash(self.upper())

Change encodekey() to use this type. For example:

    def encodekey(key):
        return _CaseInsensitiveString(encode(key))

in which encode() is still check_str().
History
Date User Action Args
2021-02-25 15:11:02eryksunsetrecipients: + eryksun, loewis, paul.moore, larry, tim.golden, r.david.murray, zach.ware, steve.dower, tzickel
2021-02-25 15:11:01eryksunsetmessageid: <1614265861.98.0.181685468733.issue28824@roundup.psfhosted.org>
2021-02-25 15:11:01eryksunlinkissue28824 messages
2021-02-25 15:11:01eryksuncreate