Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iteration Bug fix: #85

Closed
wants to merge 1 commit into from
Closed

Iteration Bug fix: #85

wants to merge 1 commit into from

Conversation

molaxx
Copy link

@molaxx molaxx commented May 21, 2022

Assumption that there are max number of levels 7 is wrong, a collision at the 7 level creates a collision node in the 8th level, this causes iteration to stop prematurely.

for reproduction (before the fix):
PYTHONHASHSEED=0 python <<EOF
import itertools
import immutables
import random
seed=b"b\xe6\xe2\x82\xe5\xc1e|"
r = random.Random(seed)
a = immutables.Map(
zip(
(r.randrange(0, 10000000000) for i in range(820000)),
itertools.repeat(None, 820000),
)
)
len1 = len(a)
len2 = len(tuple(a))
if len1 != len2:
print(f"BADDDD seed:{seed} len(a)={len1} len(tuple(a))={len2}")

EOF

Assumption that there are max number of levels 7 is wrong, a collision at the 7 level creates a collision node in the 8th level, this causes iteration to stop prematurely.
for reproduction:
PYTHONHASHSEED=0 python <<EOF
import itertools
import immutables
import random
seed=bbxe6xe2x82xe5xc1e
@molaxx molaxx mentioned this pull request May 21, 2022
@1st1
Copy link
Member

1st1 commented May 22, 2022

I've created a new PR that adds a test #87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants