[Sqlalchemy-tickets] Issue #3852: deepcopy on CollectionAdapter result in exception (zzzeek/sqlalch
Brought to you by:
zzzeek
From: ilan.gadassi <iss...@bi...> - 2016-11-14 19:31:14
|
New issue 3852: deepcopy on CollectionAdapter result in exception https://bitbucket.org/zzzeek/sqlalchemy/issues/3852/deepcopy-on-collectionadapter-result-in ilan.gadassi: version ------------ SQLAlchemy (1.1.3) Description ------------------ while calling deepcopy(destinationModel) i get the following exception ``` #!python File "research/detectors/tests/test_cnc_detector.py", line 391 in test_extend res = an.get_extension(Tick()) File "research/detectors/cnc_detector.py", line 271 in get_extension updated_destinations = deepcopy(self.destinations) File "/anaconda/lib/python2.7/copy.py", line 190 in deepcopy y = _reconstruct(x, rv, 1, memo) File "/anaconda/lib/python2.7/copy.py", line 352 in _reconstruct y.append(item) File "/anaconda/lib/python2.7/site-packages/sqlalchemy/orm/collections.py", line 1043 in append item = __set(self, item, _sa_initiator) File "/anaconda/lib/python2.7/site-packages/sqlalchemy/orm/collections.py", line 1015 in __set item = executor.fire_append_event(item, _sa_initiator) File "/anaconda/lib/python2.7/site-packages/sqlalchemy/orm/collections.py", line 678 in fire_append_event if self.invalidated: E AttributeError: invalidated ``` the destinationModel is of type InstrumentedList it seems that the deepcopy doesnt copy the invalidated attribute due to the CollectionAdapter.__getstate__ the invalidated attribute is used by CollectionAdapter.fire_append_event |