()
| 990 | |
| 991 | |
| 992 | def 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 |
nothing calls this directly
no test coverage detected