• Jason Madden's avatar
    Change cPickleCache to use PER_TypeCheck · 516f90ec
    Jason Madden authored
    Instead of testing object sizes.
    
    This matches what the pure Python implementation does and is a
    stronger test that the object really is compatible with the cache.
    Previously, an object could potentially include ``cPersistent_HEAD``
    and *not* set ``tp_base`` to ``cPersistenceCAPI->pertype`` and still
    be eligible for the pickle cache; that is no longer the case.
    
    This resolves several compiler warnings:
    
    persistent/cPickleCache.c:521:43: warning: comparison of integers of different signs: 'Py_ssize_t' (aka 'long') and 'unsigned long' [-Wsign-compare]
                    (v->ob_type->tp_basicsize >= sizeof(cPersistentObject))
                     ~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~
    persistent/cPickleCache.c:709:39: warning: comparison of integers of different signs: 'Py_ssize_t' (aka 'long') and 'unsigned long' [-Wsign-compare]
        else if (v->ob_type->tp_basicsize < sizeof(cPersistentObject))
    
    Fixes #69.
    516f90ec
To find the state of this project's repository at the time of any of these versions, check out the tags.
CHANGES.rst 7.5 KB