(self, obj)
Inner logic to save instance. Based off pickle.save_inst
Inner logic to save instance. Based off pickle.save_inst
Inner logic to save instance . Based off pickle . save_inst
def save_inst(self, obj):
        """Inner logic to save instance. Based off pickle.save_inst"""
        cls = obj.__class__

        # Try the dispatch table (pickle module doesn't do it)
        f = self.dispatch.get(cls)
        if f:
            f(self, obj)  # Call unbound method with explicit self
            return

        memo = self.memo
        write = self.write
        save = self.save

        if hasattr(obj, "__getinitargs__"):
            args = obj.__getinitargs__()
            len(args)  # XXX Assert it's a sequence
            pickle._keep_alive(args, memo)
        else:
            args = ()

        write(pickle.MARK)

        if self.bin:
            save(cls)
            for arg in args:
                save(arg)
            write(pickle.OBJ)
        else:
            for arg in args:
                save(arg)
            write(pickle.INST + cls.__module__ + "\n" + cls.__name__ + "\n")

        self.memoize(obj)

        try:
            getstate = obj.__getstate__
        except AttributeError:
            stuff = obj.__dict__
        else:
            stuff = getstate()
            pickle._keep_alive(stuff, memo)
        save(stuff)
        write(pickle.BUILD)
def save_inst ( self , obj ) : cls = obj . __class__ # Try the dispatch table (pickle module doesn't do it) f = self . dispatch . get ( cls ) if f : f ( self , obj ) # Call unbound method with explicit self return memo = self . memo write = self . write save = self . save if hasattr ( obj , "__getinitargs__" ) : args = obj . __getinitargs__ ( ) len ( args ) # XXX Assert it's a sequence pickle . _keep_alive ( args , memo ) else : args = ( ) write ( pickle . MARK ) if self . bin : save ( cls ) for arg in args : save ( arg ) write ( pickle . OBJ ) else : for arg in args : save ( arg ) write ( pickle . INST + cls . __module__ + "\n" + cls . __name__ + "\n" ) self . memoize ( obj ) try : getstate = obj . __getstate__ except AttributeError : stuff = obj . __dict__ else : stuff = getstate ( ) pickle . _keep_alive ( stuff , memo ) save ( stuff ) write ( pickle . BUILD )