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

Class BufferWrapper

Lib/multiprocessing/heap.py:322–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320#
321
322class BufferWrapper(object):
323
324 _heap = Heap()
325
326 def __init__(self, size):
327 if size < 0:
328 raise ValueError("Size {0:n} out of range".format(size))
329 if sys.maxsize <= size:
330 raise OverflowError("Size {0:n} too large".format(size))
331 block = BufferWrapper._heap.malloc(size)
332 self._state = (block, size)
333 util.Finalize(self, BufferWrapper._heap.free, args=(block,))
334
335 def create_memoryview(self):
336 (arena, start, stop), size = self._state
337 return memoryview(arena.buffer)[start:start+size]

Callers 1

__init__Method · 0.85

Calls 1

HeapClass · 0.85

Tested by

no test coverage detected