Message340381
> As it stands, calling Element.__deepcopy__() will succeed with the C
> implementation and fail with the Python implementation.
You should not call it directly. Use copy.deepcopy().
> What is
> different about the C implementation that requires the definition of
> __deepcopy__() in the first place?
__deepcopy__() in the C implementation is merely optimization. It is less efficient to convert from the efficient internal representation of Element object to tuples and dicts and back.
> However, create_new_element()
> does not make a copy of the attrib dict that is passed in, meaning that
> the internal attrib dict of an Element instance is mutable by changing
> the dict that was passed in.
create_new_element() usually is called with a new copy of the attrib dict. Making yet one copy inside it is just a waste of time. If in some cases it is called with an externally referred dict, fix these cases by making a copy before calling create_new_element(). |
|
Date |
User |
Action |
Args |
2019-04-17 06:50:17 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, scoder, r.david.murray, eli.bendersky, asvetlov, thatiparthy, mdk, p-ganssle, gphemsley |
2019-04-17 06:50:17 | serhiy.storchaka | set | messageid: <1555483817.12.0.751817903005.issue32424@roundup.psfhosted.org> |
2019-04-17 06:50:16 | serhiy.storchaka | link | issue32424 messages |
2019-04-17 06:50:16 | serhiy.storchaka | create | |
|