pop() fails for collection_class=set
Issue #548
resolved
the 'pop' wrapper on InstrumentedList is implementing list sementics for pop() even if the underlying collection is a set.
Traceback (most recent call last):
...
File "sqlalchemy/lib/sqlalchemy/orm/attributes.py", line 590, in pop
item = self.data[i](i)
TypeError: 'set' object is unindexable
To fix, need knowledge of the underlying type (e.g. #213) or add a _data_popper ala _data_appender to differentiate.
To workaround, replace {{{item = myobj.collection.pop()}}} on non-empty sets with something like:
item = list(myobj.collection)[0](0)
myobj.collection.remove(item)
Comments (4)
-
repo owner -
repo owner - changed milestone to 0.4.0
- assigned issue to
-
reporter - changed status to resolved
fixed along with
#213in 0.4, tested in b716af2c4247e0ce3aa0a35fb7c519b87832d585 -
repo owner - removed milestone
Removing milestone: 0.4.0 (automated comment)
- Log in to comment
hey jek -
why not work on
#213? you can create a sandbox branch if you like. it also is implicated in some features I want to add regarding value collections (i.e. mapped collections of non-entity values)