You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2017/05/31 17:46:40 UTC
[11/14] arrow git commit: ARROW-1060: [Python] Add unit tests for
reference counts in memoryview interface
ARROW-1060: [Python] Add unit tests for reference counts in memoryview interface
Add missing test case for ARROW-1053.
Author: Wes McKinney <we...@twosigma.com>
Closes #710 from wesm/ARROW-1060 and squashes the following commits:
013fc248 [Wes McKinney] Add unit tests to check that reference counts stay constant via memoryview interface
Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/aa652cb3
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/aa652cb3
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/aa652cb3
Branch: refs/heads/master
Commit: aa652cb3f5ea4b1f845ea2ef3e10344b050f45b3
Parents: 84b7ee1
Author: Wes McKinney <we...@twosigma.com>
Authored: Tue May 23 14:08:39 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Wed May 31 13:45:48 2017 -0400
----------------------------------------------------------------------
python/pyarrow/tests/test_io.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/arrow/blob/aa652cb3/python/pyarrow/tests/test_io.py
----------------------------------------------------------------------
diff --git a/python/pyarrow/tests/test_io.py b/python/pyarrow/tests/test_io.py
index f91dc6f..397b7a8 100644
--- a/python/pyarrow/tests/test_io.py
+++ b/python/pyarrow/tests/test_io.py
@@ -19,6 +19,7 @@ from io import BytesIO
import gc
import os
import pytest
+import sys
import numpy as np
@@ -201,8 +202,6 @@ def test_inmemory_write_after_closed():
def test_buffer_protocol_ref_counting():
- import gc
-
def make_buffer(bytes_obj):
return bytearray(pa.frombuffer(bytes_obj))
@@ -210,6 +209,14 @@ def test_buffer_protocol_ref_counting():
gc.collect()
assert buf == b'foo'
+ # ARROW-1053
+ val = b'foo'
+ refcount_before = sys.getrefcount(val)
+ for i in range(10):
+ make_buffer(val)
+ gc.collect()
+ assert refcount_before == sys.getrefcount(val)
+
def test_nativefile_write_memoryview():
f = pa.BufferOutputStream()