Closed jamadden closed 6 years ago
That change seems "safe" (won't cause coredumps), because the PyObject_IsInstance
test should be a strict subset of the size check. I don't know if there is any code in the wild which is using not-actually-instances-of-Persistent objects which are accidentally big enough (and have fakey slots to boot), but ISTM that such hypothetical code Deserves to Lose(TM).
From cPickleCache.c's
cc_add
function:I think I agree with the code's own comment that 'checking sizeof() seems a poor test'. Why does it do that instead of using
PyObject_IsInstance
(which is what the Python implementation of PickleCache does)? Could that check be changed?(Ref https://github.com/zopefoundation/Persistence/pull/9)