MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / commit_frame

Method commit_frame

tools/python-3.11.9-amd64/Lib/pickle.py:217–239  ·  view source on GitHub ↗
(self, force=False)

Source from the content-addressed store, hash-verified

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

Callers 4

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

Calls 4

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

Tested by

no test coverage detected