[New-bugs-announce] [issue41531] Python 3.9 regression: Literal dict with > 65535 items are one item shorter

Miro Hrončok report at bugs.python.org
Wed Aug 12 11:42:56 EDT 2020


New submission from Miro Hrončok <miro at hroncok.cz>:

Consider this reproducer.py:

import sys
LEN = int(sys.argv[1])

with open('big_dict.py', 'w') as f:
    print('INTS = {', file=f)
    for i in range(LEN):
        print(f'    {i}: None,', file=f)
    print('}', file=f)


import big_dict
assert len(big_dict.INTS) == LEN, len(big_dict.INTS)



And run it with any number > 65535:

$ python3.9 reproducer.py 65536
Traceback (most recent call last):
  File "/tmp/reproducer.py", line 12, in <module>
    assert len(big_dict.INTS) == LEN, len(big_dict.INTS)
AssertionError: 65535


This has not happened on python 3.8. This also happens with PYTHONOLDPARSER=1.

----------
messages: 375255
nosy: hroncok
priority: normal
severity: normal
status: open
title: Python 3.9 regression: Literal dict with > 65535 items are one item shorter
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41531>
_______________________________________


More information about the New-bugs-announce mailing list