[pypy-commit] pypy cpyext-gc-support-2: From RPython code, don't accept NULL (an lltype ptr typed "void *") in

arigo pypy.commits at gmail.com
Tue Feb 16 11:58:55 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: cpyext-gc-support-2
Changeset: r82289:f782eb8ae5dd
Date: 2016-02-16 17:58 +0100
http://bitbucket.org/pypy/pypy/changeset/f782eb8ae5dd/

Log:	From RPython code, don't accept NULL (an lltype ptr typed "void *")
	in the "PyObject *" arguments. Use either a correctly-typed NULL, or
	simply say None

diff --git a/pypy/module/cpyext/test/test_ndarrayobject.py b/pypy/module/cpyext/test/test_ndarrayobject.py
--- a/pypy/module/cpyext/test/test_ndarrayobject.py
+++ b/pypy/module/cpyext/test/test_ndarrayobject.py
@@ -80,7 +80,7 @@
         a0 = scalar(space)
         assert a0.get_scalar_value().value == 10.
 
-        a = api._PyArray_FromAny(a0, NULL, 0, 0, 0, NULL)
+        a = api._PyArray_FromAny(a0, None, 0, 0, 0, NULL)
         assert api._PyArray_NDIM(a) == 0
 
         ptr = rffi.cast(rffi.DOUBLEP, api._PyArray_DATA(a))
@@ -88,10 +88,10 @@
 
     def test_FromAny(self, space, api):
         a = array(space, [10, 5, 3])
-        assert api._PyArray_FromAny(a, NULL, 0, 0, 0, NULL) is a
-        assert api._PyArray_FromAny(a, NULL, 1, 4, 0, NULL) is a
+        assert api._PyArray_FromAny(a, None, 0, 0, 0, NULL) is a
+        assert api._PyArray_FromAny(a, None, 1, 4, 0, NULL) is a
         self.raises(space, api, ValueError, api._PyArray_FromAny,
-                    a, NULL, 4, 5, 0, NULL)
+                    a, None, 4, 5, 0, NULL)
 
     def test_FromObject(self, space, api):
         a = array(space, [10, 5, 3])


More information about the pypy-commit mailing list