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

Method save_frozenset

Lib/pickle.py:1143–1167  ·  view source on GitHub ↗
(self, obj)

Source from the content-addressed store, hash-verified

1141 dispatch[set] = save_set
1142
1143 def save_frozenset(self, obj):
1144 save = self.save
1145 write = self.write
1146
1147 if self.proto < 4:
1148 self.save_reduce(frozenset, (list(obj),), obj=obj)
1149 return
1150
1151 write(MARK)
1152 try:
1153 for item in obj:
1154 save(item)
1155 except BaseException as exc:
1156 exc.add_note(f'when serializing {_T(obj)} element')
1157 raise
1158
1159 if id(obj) in self.memo:
1160 # If the object is already in the memo, this means it is
1161 # recursive. In this case, throw away everything we put on the
1162 # stack, and fetch the object back from the memo.
1163 write(POP_MARK + self.get(self.memo[id(obj)][0]))
1164 return
1165
1166 write(FROZENSET)
1167 self.memoize(obj)
1168 dispatch[frozenset] = save_frozenset
1169
1170 def save_global(self, obj, name=None):

Callers

nothing calls this directly

Calls 7

save_reduceMethod · 0.95
getMethod · 0.95
memoizeMethod · 0.95
listClass · 0.85
_TFunction · 0.85
idFunction · 0.85
writeFunction · 0.70

Tested by

no test coverage detected