MCPcopy Index your code
hub / github.com/RustPython/RustPython / commit_frame

Method commit_frame

Lib/pickle.py:210–232  ·  view source on GitHub ↗
(self, force=False)

Source from the content-addressed store, hash-verified

208 self.current_frame = None
209
210 def commit_frame(self, force=False):
211 if self.current_frame:
212 f = self.current_frame
213 if f.tell() >= self._FRAME_SIZE_TARGET or force:
214 data = f.getbuffer()
215 write = self.file_write
216 if len(data) >= self._FRAME_SIZE_MIN:
217 # Issue a single call to the write method of the underlying
218 # file object for the frame opcode with the size of the
219 # frame. The concatenation is expected to be less expensive
220 # than issuing an additional call to write.
221 write(FRAME + pack("<Q", len(data)))
222
223 # Issue a separate call to write to append the frame
224 # contents without concatenation to the above to avoid a
225 # memory copy.
226 write(data)
227
228 # Start the new frame with a new io.BytesIO instance so that
229 # the file object can have delayed access to the previous frame
230 # contents via an unreleased memoryview of the previous
231 # io.BytesIO instance.
232 self.current_frame = io.BytesIO()
233
234 def write(self, data):
235 if self.current_frame:

Callers 4

end_framingMethod · 0.95
write_large_bytesMethod · 0.95
optimizeFunction · 0.80
saveMethod · 0.80

Calls 5

packFunction · 0.90
lenFunction · 0.85
writeFunction · 0.70
tellMethod · 0.45
getbufferMethod · 0.45

Tested by

no test coverage detected