• Jeremy Hylton's avatar
    Two fixes to find_class: · d1055237
    Jeremy Hylton yazdı
    1. Only DECREF the class's module when the module is retrieved via
    PyImport_Import.  If it is retrieved from the modules dictionary with
    PyDict_GetItem, it is using a borrowed reference.
    
    2. If the module doesn't define the desired class, raise the same
    SystemError that pickle.py does instead of returning an AttributeError
    (which is cryptic at best).
    
    Also, fix the PyArg_ParseTuple in cpm_loads (the externally visible
    loads) function:  Use "S" instead of "O" because cStringIO will croak
    with a "bad arguments to internal function" if passed anything other
    than a string.
    d1055237
cPickle.c 95 KB