Read a pickled object representation from the open file. Return the reconstituted object hierarchy specified in the file.
(self)
| 1298 | self.fix_imports = fix_imports |
| 1299 | |
| 1300 | def load(self): |
| 1301 | """Read a pickled object representation from the open file. |
| 1302 | |
| 1303 | Return the reconstituted object hierarchy specified in the file. |
| 1304 | """ |
| 1305 | # Check whether Unpickler was initialized correctly. This is |
| 1306 | # only needed to mimic the behavior of _pickle.Unpickler.dump(). |
| 1307 | if not hasattr(self, "_file_read"): |
| 1308 | raise UnpicklingError("Unpickler.__init__() was not called by " |
| 1309 | "%s.__init__()" % (self.__class__.__name__,)) |
| 1310 | self._unframer = _Unframer(self._file_read, self._file_readline) |
| 1311 | self.read = self._unframer.read |
| 1312 | self.readinto = self._unframer.readinto |
| 1313 | self.readline = self._unframer.readline |
| 1314 | self.metastack = [] |
| 1315 | self.stack = [] |
| 1316 | self.append = self.stack.append |
| 1317 | self.proto = 0 |
| 1318 | read = self.read |
| 1319 | dispatch = self.dispatch |
| 1320 | try: |
| 1321 | while True: |
| 1322 | key = read(1) |
| 1323 | if not key: |
| 1324 | raise EOFError |
| 1325 | assert isinstance(key, bytes_types) |
| 1326 | dispatch[key[0]](self) |
| 1327 | except _Stop as stopinst: |
| 1328 | return stopinst.value |
| 1329 | |
| 1330 | # Return a list of items pushed in the stack after last MARK instruction. |
| 1331 | def pop_mark(self): |