[python-arrayfire] 224/250: Changing deprecated functions

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:51 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository python-arrayfire.

commit 6545b5a7614b5925c1e94aac864824d09f69ce62
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Wed Mar 2 15:03:49 2016 -0500

    Changing deprecated functions
---
 arrayfire/device.py    | 22 ++++++++++++++++++----
 tests/simple/device.py |  4 ++--
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/arrayfire/device.py b/arrayfire/device.py
index f84404f..cfdbb76 100644
--- a/arrayfire/device.py
+++ b/arrayfire/device.py
@@ -241,6 +241,14 @@ def get_device_ptr(a):
 
 def lock_device_ptr(a):
     """
+    This functions is deprecated. Please use lock_array instead.
+    """
+    import warnings
+    warnings.warn("This function is deprecated. Use lock_array instead.", DeprecationWarning)
+    lock_array(a)
+
+def lock_array(a):
+    """
     Ask arrayfire to not perform garbage collection on raw data held by an array.
 
     Parameters
@@ -252,11 +260,18 @@ def lock_device_ptr(a):
     -----
         - The device pointer of `a` is not freed by memory manager until `unlock_device_ptr()` is called.
     """
-    ptr = ct.c_void_p(0)
-    safe_call(backend.get().af_lock_device_ptr(a.arr))
+    safe_call(backend.get().af_lock_array(a.arr))
 
 def unlock_device_ptr(a):
     """
+    This functions is deprecated. Please use unlock_array instead.
+    """
+    import warnings
+    warnings.warn("This function is deprecated. Use unlock_array instead.", DeprecationWarning)
+    unlock_array(a)
+
+def unlock_array(a):
+    """
     Tell arrayfire to resume garbage collection on raw data held by an array.
 
     Parameters
@@ -265,7 +280,6 @@ def unlock_device_ptr(a):
        - A multi dimensional arrayfire array.
 
     """
-    ptr = ct.c_void_p(0)
-    safe_call(backend.get().af_unlock_device_ptr(a.arr))
+    safe_call(backend.get().af_unlock_array(a.arr))
 
 from .array import Array
diff --git a/tests/simple/device.py b/tests/simple/device.py
index 3fe019c..925add2 100644
--- a/tests/simple/device.py
+++ b/tests/simple/device.py
@@ -48,7 +48,7 @@ def simple_device(verbose=False):
     display_func(b)
 
     c = af.randu(10,10)
-    af.lock_device_ptr(c)
-    af.unlock_device_ptr(c)
+    af.lock_array(c)
+    af.unlock_array(c)
 
 _util.tests['device'] = simple_device

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-arrayfire.git



More information about the debian-science-commits mailing list