Skip to content

Tools/unicode/gencodec.py generates duplicate dict keys with different values #105556

@vstinner

Description

@vstinner

Example with Lib/encodings/mac_arabic.py generated from VENDORS/APPLE/ARABIC.TXT:

decoding_map.update({
    # ...
    0x0020: 0x0020,     #  SPACE, left-right
    0x0020: 0x00a0,     #  SPACE, right-left
    0x0021: 0x0021,     #  EXCLAMATION MARK, left-right
    0x0021: 0x00a1,     #  EXCLAMATION MARK, right-left
    0x0022: 0x0022,     #  QUOTATION MARK, left-right
    0x0022: 0x00a2,     #  QUOTATION MARK, right-left
    0x0023: 0x0023,     #  NUMBER SIGN, left-right
    0x0023: 0x00a3,     #  NUMBER SIGN, right-left
    # ...
}

pyflakes generates warnings like:

./Lib/encodings/mac_arabic.py:474:5: dictionary key 32 repeated with different values
./Lib/encodings/mac_arabic.py:475:5: dictionary key 32 repeated with different values
./Lib/encodings/mac_arabic.py:476:5: dictionary key 33 repeated with different values
./Lib/encodings/mac_arabic.py:477:5: dictionary key 33 repeated with different values
./Lib/encodings/mac_arabic.py:478:5: dictionary key 34 repeated with different values
./Lib/encodings/mac_arabic.py:479:5: dictionary key 34 repeated with different values
./Lib/encodings/mac_arabic.py:480:5: dictionary key 35 repeated with different values

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