def __getstate__(self):
        """Override pickling behavior."""
        # pickling pointer is not allowed
        is_open = self.is_open
        self.close()
        d = dict(self.__dict__)
        d['is_open'] = is_open
        uri = self.uri.value
        try:
            uri = uri.decode('utf-8')
        except AttributeError:
            pass
        del d['handle']
        d['uri'] = uri
        return d
def __getstate__ ( self ) : is_open = self . is_open self . close ( ) d = dict ( self . __dict__ ) d [ 'is_open' ] = is_open uri = self . uri . value try : uri = uri . decode ( 'utf-8' ) except AttributeError : pass del d [ 'handle' ] d [ 'uri' ] = uri return d
Override pickling behavior.