MagicStack / immutables

A high-performance immutable mapping type for Python.
Other
1.14k stars 57 forks source link

PyMapNoneTest.test_none_collisions fails on 32-bit x86 systems #50

Closed mgorny closed 3 years ago

mgorny commented 4 years ago

When running the package's tests on 32-bit x86, I get the following failure:

$ pytest
=============================================================== test session starts ===============================================================
platform linux -- Python 3.7.9, pytest-5.4.2, py-1.8.0, pluggy-0.13.1
rootdir: /home/mgorny/immutables, inifile: pytest.ini, testpaths: tests
plugins: hypothesis-5.18.1, services-2.0.1, backports.unittest-mock-1.5
collected 152 items                                                                                                                               

tests/test_issue24.py .....sssssss
tests/test_map.py .............................................................sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
tests/test_none_keys.py ......F..sssssssss

==================================================================== FAILURES =====================================================================
_______________________________________________________ PyMapNoneTest.test_none_collisions ________________________________________________________
Traceback (most recent call last):
  File "/home/mgorny/immutables/tests/test_none_keys.py", line 47, in test_none_collisions
    self.assertEqual(map_mask(c_hash, j*5), idx)
  File "/usr/lib/python3.7/unittest/case.py", line 852, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib/python3.7/unittest/case.py", line 845, in _baseAssertEqual
    raise self.failureException(msg)
AssertionError: 10 != 9
============================================================= short test summary info =============================================================
FAILED tests/test_none_keys.py::PyMapNoneTest::test_none_collisions - AssertionError: 10 != 9
==================================================== 1 failed, 74 passed, 77 skipped in 17.31s ====================================================

I've been able to bisect this to:

commit 913572c2ef8a4c948bb8b67ff2064d6920e313e7
Author: TIGirardi <55336837+TIGirardi@users.noreply.github.com>
Date:   Mon May 18 00:58:10 2020 -0300

    Accept None as a key in pure python module (#42)

 immutables/map.py       |  31 +--
 tests/test_none_keys.py | 511 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 530 insertions(+), 12 deletions(-)
 create mode 100644 tests/test_none_keys.py

Original bug report: https://bugs.gentoo.org/739578

thesamesam commented 4 years ago

The same failure occurs on an arm64 kernel with armv7 userland (in 32-bit mode).

1st1 commented 4 years ago

Interesting. Would really appreciate if you guys could debug this. That would be a huge help!

frispete commented 4 years ago

Hmm, shouldn't @TIGirardi know his code best?

It looks, like the missing hash is _NULL (the _Unhashable one, isn't it?)

Scratch that, doesn't explain, why it fails for 32 bit archs only.

frispete commented 4 years ago

Here's a build log of a failing build: https://build.opensuse.org/package/live_build_log/home:frispete:python/python-immutables/openSUSE_Tumbleweed/i586

The link isn't valid anymore, because I've disabled the 32bit build (i586) for now. If somebody cares about this, I will hopefully notice and enable those builds again.

mgorny commented 3 years ago

Ping.

mgorny commented 3 years ago

Thank you! Are you planning on making a new release soon-ish?

elprans commented 3 years ago

Yes, once #70 lands.

mgorny commented 3 years ago

Ok, cool. I've decided to backport it to Gentoo immediately anyway ;-).