Set type broken?

Hi,

I’ve got a fairly complex script that seems to show a bug in RhinoPython.

When you run it in RhinoPython it stops at a point where there are two identical items (integers) in a set. From my understanding this should not be possible. Running the same script in CPython does not show this behaviour.

So far unfortunately I’ve not been able to simplify it any further while still showing this error, sorry for that.

(If you remove the assert statement the script will terminate with an error at a later stage trying to extract an item from the set by means of set.pop(). At that stage the set does not have an item but its length is not zero.)

brokenset.py (4.1 KB)

Kind regards,
Gero.

P.S. This is my Rhino version (running on Windows 7):
Version 5 SR6 64-bit
(5.6.31028.18305, 28/10/2013)

P.P.S. It’s the set.update() on line 71 that adds the same value again that’s already in the set. The condition adjacentElems==set((14,3, 4, 7)) is true just before the update that’s not working.

Hi Gero,
I’m not exactly sure what is going wrong here; it may be a bug but I just can’t tell. In any case, it does look like changing the “update” line to

adjacentElems = adjacentElems.union( elemsOnFace ) # adds one or none

fixes the issue.