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/23 18:08:46 UTC

arrow git commit: ARROW-1060: [Python] Add unit tests for reference counts in memoryview interface

Repository: arrow
Updated Branches:
  refs/heads/master 8c00bb683 -> 1863a0193


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/1863a019
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/1863a019
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/1863a019

Branch: refs/heads/master
Commit: 1863a01938ee3d82b6b57b6e22c367c46996df2a
Parents: 8c00bb6
Author: Wes McKinney <we...@twosigma.com>
Authored: Tue May 23 14:08:39 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Tue May 23 14:08:39 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/1863a019/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()