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

Function _to_memoryview

Lib/test/test_io/test_textio.py:1439–1445  ·  view source on GitHub ↗

Convert bytes-object *buf* to a non-trivial memoryview

(buf)

Source from the content-addressed store, hash-verified

1437 return _to_memoryview(super().read(len_))
1438
1439def _to_memoryview(buf):
1440 '''Convert bytes-object *buf* to a non-trivial memoryview'''
1441
1442 arr = array.array('i')
1443 idx = len(buf) - len(buf) % arr.itemsize
1444 arr.frombytes(buf[:idx])
1445 return memoryview(arr)
1446
1447
1448class CTextIOWrapperTest(TextIOWrapperTest, CTestCase):

Callers 3

test_read_byteslikeMethod · 0.85
read1Method · 0.85
readMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…