Closed agroszer closed 7 years ago
I see a few possible options here:
PyMapping_Items
and PyObject_SetItem
instead of PyDict_Next
. If you need the speed of PyDict_Next
a check via PyDict_CheckExact
could be done. If it returns False
use the generic methods as a fallback.PyDict_CheckExact
returns False
. Which is the most promising one, since its easy to implement. Yes you loose the optimization if a non builtin dict comes in, but I guess this does not happen very often.
Key interning introduced in https://github.com/zopefoundation/persistent/commit/7bd85c189ae17be514f4989bfb8f79f4d8013943 makes
__setstate__
SILENTLY fail when a non-builtin dict is passed as state.See https://github.com/agroszer/persistent/commit/1c1cebaf79914420a9de61e55fb72a75981965b2 how to provoke that.
state
must be a builtin dict ?