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

Method save_set

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

Source from the content-addressed store, hash-verified

1119 write(SETITEM)
1120
1121 def save_set(self, obj):
1122 save = self.save
1123 write = self.write
1124
1125 if self.proto < 4:
1126 self.save_reduce(set, (list(obj),), obj=obj)
1127 return
1128
1129 write(EMPTY_SET)
1130 self.memoize(obj)
1131
1132 for batch in batched(obj, self._BATCHSIZE):
1133 write(MARK)
1134 try:
1135 for item in batch:
1136 save(item)
1137 except BaseException as exc:
1138 exc.add_note(f'when serializing {_T(obj)} element')
1139 raise
1140 write(ADDITEMS)
1141 dispatch[set] = save_set
1142
1143 def save_frozenset(self, obj):

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected