示例#1
0
 def __init__(self, file, protocol=None):
     if protocol is None:
         protocol = DEFAULT_PROTOCOL
     Pickler.__init__(self, file, protocol=protocol)
     # map functions __globals__ attribute ids, to ensure that functions
     # sharing the same global namespace at pickling time also share
     # their global namespace at unpickling time.
     self.globals_ref = {}
     assert hasattr(self, 'proto')
示例#2
0
 def __init__(self, file, protocol=None, buffer_callback=None):
     if protocol is None:
         protocol = DEFAULT_PROTOCOL
     Pickler.__init__(self,
                      file,
                      protocol=protocol,
                      buffer_callback=buffer_callback)
     self.globals_ref = {}
     self.proto = int(protocol)
示例#3
0
 def __init__(self, file, protocol=None, buffer_callback=None):
     if protocol is None:
         protocol = DEFAULT_PROTOCOL
     Pickler.__init__(self,
                      file,
                      protocol=protocol,
                      buffer_callback=buffer_callback)
     # map functions __globals__ attribute ids, to ensure that functions
     # sharing the same global namespace at pickling time also share
     # their global namespace at unpickling time.
     self.globals_ref = {}
     self.proto = int(protocol)
示例#4
0
    def __init__(self, file, protocol=None, buffer_callback=None):
        if protocol is None:
            protocol = DEFAULT_PROTOCOL
        Pickler.__init__(self, file, protocol=protocol, buffer_callback=buffer_callback)
        # map functions __globals__ attribute ids, to ensure that functions
        # sharing the same global namespace at pickling time also share their
        # global namespace at unpickling time.
        self.globals_ref = {}

        # Take into account potential custom reducers registered by external
        # modules
        self.dispatch_table = copyreg.dispatch_table.copy()
        self.dispatch_table.update(self.dispatch)
        self.proto = int(protocol)