• Barry Warsaw's avatar
    Two changes: · bf4d959d
    Barry Warsaw yazdı
    load_inst(): Implement the security hook that cPickle already had.
    When unpickling callables which are not classes, we look to see if the
    object has an attribute __safe_for_unpickling__.  If this exists and
    has a true value, then we can call it to create the unpickled object.
    Otherwise we raise an UnpicklingError.
    
    find_class(): We no longer mask ImportError, KeyError, and
    AttributeError by transforming them into SystemError.  The latter is
    definitely not the right thing to do, so we let the former three
    exceptions simply propagate up if they occur, i.e. we remove the
    try/except!
    bf4d959d
pickle.py 26.1 KB