Skip to content

tests/test_hash_trie_map.py::test_hashing - pyo3_runtime.PanicException: attempt to multiply with overflow and more #86

@mgorny

Description

@mgorny

The test suite of 0.20.0 release fails with PyO3 panics when built with --profile=dev.

To reproduce:

pip install -e . -Cbuild-args=--profile=dev
pip install pytest
pytest

Output:

========================================================= test session starts =========================================================
platform linux -- Python 3.12.4, pytest-8.3.2, pluggy-1.5.0
rootdir: /tmp/rpds
configfile: pyproject.toml
collected 116 items                                                                                                                   

tests/test_hash_trie_map.py ............F.F............................................                                         [ 50%]
tests/test_hash_trie_set.py ..F..................                                                                               [ 68%]
tests/test_list.py ...................                                                                                          [ 85%]
tests/test_queue.py .................                                                                                           [100%]

============================================================== FAILURES ===============================================================
____________________________________________________________ test_hashing _____________________________________________________________

    def test_hashing():
        o = object()
    
>       assert hash(HashTrieMap([(o, o), (1, o)])) == hash(
            HashTrieMap([(o, o), (1, o)]),
        )
E       pyo3_runtime.PanicException: attempt to multiply with overflow

tests/test_hash_trie_map.py:157: PanicException
-------------------------------------------------------- Captured stderr call ---------------------------------------------------------
thread '<unnamed>' panicked at src/lib.rs:13:5:
attempt to multiply with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
_______________________________________ test_map_does_not_hash_values_on_second_hash_invocation _______________________________________

    def test_map_does_not_hash_values_on_second_hash_invocation():
        hashable = HashabilityControlled()
        x = HashTrieMap(dict(el=hashable))
>       hash(x)
E       pyo3_runtime.PanicException: attempt to multiply with overflow

tests/test_hash_trie_map.py:196: PanicException
-------------------------------------------------------- Captured stderr call ---------------------------------------------------------
thread '<unnamed>' panicked at src/lib.rs:13:5:
attempt to multiply with overflow
____________________________________________________________ test_hashing _____________________________________________________________

    def test_hashing():
        o = object()
    
>       assert hash(HashTrieSet([o])) == hash(HashTrieSet([o]))
E       pyo3_runtime.PanicException: attempt to multiply with overflow

tests/test_hash_trie_set.py:51: PanicException
-------------------------------------------------------- Captured stderr call ---------------------------------------------------------
thread '<unnamed>' panicked at src/lib.rs:13:5:
attempt to multiply with overflow
======================================================= short test summary info =======================================================
FAILED tests/test_hash_trie_map.py::test_hashing - pyo3_runtime.PanicException: attempt to multiply with overflow
FAILED tests/test_hash_trie_map.py::test_map_does_not_hash_values_on_second_hash_invocation - pyo3_runtime.PanicException: attempt to multiply with overflow
FAILED tests/test_hash_trie_set.py::test_hashing - pyo3_runtime.PanicException: attempt to multiply with overflow
==================================================== 3 failed, 113 passed in 0.32s ====================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions