Issue #6 resolved

FastRBTree Error

Peter Mell
created an issue

Python crashes when using FastRBTree while creating and manipulating large numbers of trees (tens of thousands). It exhibits the same behavior with FastBinaryTree and FastAVLTree but it DOES NOT have the error using RBTree. I've cut down my code to a meaningless 35 line snippet that exhibits the error (see attached). To see the code work correctly, just change line 30 to use RBTree instead of FastRBTree. Lastly, I'm developing on Windows using Python 2.7.3 and bintrees 1.0.3.

This may the the same issue that is already open but just manifesting itself differently. The other issue cites copying trees, which my attached code doesn't do at all.

Comments (6)

  1. Manfred Moitzi repo owner


    The error is reproduceable on Win7 Pro x64 and on Linux Mint 15.

    On Linux I got a "Speicherzugriffsfehler" (memory access error).

    Quick Solution: Replace list-key ["test1", "test2"] by tuple-key ("test1", "test2") -> no crash

    I assume: you can't use mutable keys (which is never a good idea) - I use the Python compare function PyObject_RichCompareBool() at C level.

    But i don't know if this is the real problem, because this shouldn't crash Python.

    Let me know if this solves your problems.

    Best regards, Manfred

  2. Peter Mell reporter

    Thanks for the help!! I tried your advice and replaced list-keys with tuple-keys. In my previously attached example code, this does stop Python from crashing. However, when I took the same approach in my actual much larger program, the results were mixed. I now have a more complicated example (while using tuple-keys) that crashes Python when using FastRBTree but not with RBTree. I'll open up a new issue for the new error code although the underlying bugs are probably related.

  3. Log in to comment