MCPcopy Create free account
hub / github.com/apache/arrow / test_buffer_protocol_ref_counting

Function test_buffer_protocol_ref_counting

python/pyarrow/tests/test_io.py:992–1006  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

990
991
992def test_buffer_protocol_ref_counting():
993 def make_buffer(bytes_obj):
994 return bytearray(pa.py_buffer(bytes_obj))
995
996 buf = make_buffer(b'foo')
997 gc.collect()
998 assert buf == b'foo'
999
1000 # ARROW-1053
1001 val = b'foo'
1002 refcount_before = sys.getrefcount(val)
1003 for i in range(10):
1004 make_buffer(val)
1005 gc.collect()
1006 assert refcount_before == sys.getrefcount(val)
1007
1008
1009@pytest.mark.numpy

Callers

nothing calls this directly

Calls 1

make_bufferFunction · 0.85

Tested by

no test coverage detected