MCPcopy Index your code
hub / github.com/python/cpython / persistent_load

Method persistent_load

Doc/includes/dbpickle.py:32–46  ·  view source on GitHub ↗
(self, pid)

Source from the content-addressed store, hash-verified

30 self.connection = connection
31
32 def persistent_load(self, pid):
33 # This method is invoked whenever a persistent ID is encountered.
34 # Here, pid is the tuple returned by DBPickler.
35 cursor = self.connection.cursor()
36 type_tag, key_id = pid
37 if type_tag == "MemoRecord":
38 # Fetch the referenced record from the database and return it.
39 cursor.execute("SELECT * FROM memos WHERE key=?", (str(key_id),))
40 key, task = cursor.fetchone()
41 return MemoRecord(key, task)
42 else:
43 # Always raises an error if you cannot return the correct object.
44 # Otherwise, the unpickler will think None is the object referenced
45 # by the persistent ID.
46 raise pickle.UnpicklingError("unsupported persistent object")
47
48
49def main():

Callers

nothing calls this directly

Calls 2

strFunction · 0.85
executeMethod · 0.45

Tested by

no test coverage detected