[pypy-commit] pypy py3k-update: more test fixes

rlamy pypy.commits at gmail.com
Fri Apr 29 15:03:17 EDT 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3k-update
Changeset: r84036:81e8c1b4cde0
Date: 2016-04-29 20:02 +0100
http://bitbucket.org/pypy/pypy/changeset/81e8c1b4cde0/

Log:	more test fixes

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -1320,7 +1320,7 @@
     for name, (typ, expr) in sorted(GLOBALS.items()):
         if '#' in name:
             name, header = name.split('#')
-            assert typ in ('PyObject*', 'PyTypeObject*', 'PyIntObject*')
+            assert typ in ('PyObject*', 'PyTypeObject*')
             typ = typ[:-1]
             if header != pypy_decl:
                 # since the #define is not in pypy_macros, do it here
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
@@ -4,7 +4,7 @@
 from rpython.rtyper.lltypesystem import rffi, lltype
 from pypy.module.micronumpy.ndarray import W_NDimArray
 from pypy.module.micronumpy.descriptor import get_dtype_cache
-import pypy.module.micronumpy.constants as NPY 
+import pypy.module.micronumpy.constants as NPY
 
 py.test.skip("Micronumpy not yet supported on py3k.")
 
@@ -239,7 +239,7 @@
                 skip('numpy not importable')
         else:
             cls.w_numpy_include = cls.space.wrap([])
-            
+
 
     def test_ndarray_object_c(self):
         mod = self.import_extension('foo', [
@@ -272,7 +272,7 @@
                 {
                     /* Should have failed */
                     Py_DECREF(obj1);
-                    return NULL; 
+                    return NULL;
                 }
                 return obj1;
                 '''
@@ -299,14 +299,14 @@
                 ),
                 ("test_DescrFromType", "METH_O",
                 """
-                    Signed typenum = PyInt_AsLong(args);
+                    Signed typenum = PyLong_AsLong(args);
                     return PyArray_DescrFromType(typenum);
                 """
                 ),
-                ], include_dirs=self.numpy_include, 
+                ], include_dirs=self.numpy_include,
                    prologue='''
                 #ifdef PYPY_VERSION
-                    #include <pypy_numpy.h>    
+                    #include <pypy_numpy.h>
                 #endif
                 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
                 #include <numpy/arrayobject.h>
@@ -314,7 +314,7 @@
                     #define PyArray_FromObject _PyArray_FromObject
                     #define PyArray_FromAny _PyArray_FromAny
                 #endif
-                ''', 
+                ''',
                     more_init = '''
                 #ifndef PYPY_VERSION
                     import_array();
@@ -348,14 +348,14 @@
                     Py_INCREF(obj);
                     return obj;
                 '''),
-                ], include_dirs=self.numpy_include, 
+                ], include_dirs=self.numpy_include,
                    prologue='''
                 #ifdef PYPY_VERSION
-                    #include <pypy_numpy.h>    
+                    #include <pypy_numpy.h>
                 #endif
                 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
                 #include <numpy/arrayobject.h>
-                ''', 
+                ''',
                     more_init = '''
                 #ifndef PYPY_VERSION
                     import_array();
@@ -402,14 +402,14 @@
                 void *array_data[] = {NULL, NULL};
                 return PyUFunc_FromFuncAndDataAndSignature(funcs,
                                     array_data, types, 1, 1, 1, PyUFunc_None,
-                                    "float_3x3", 
-                                    "a ufunc that tests a more complicated signature", 
+                                    "float_3x3",
+                                    "a ufunc that tests a more complicated signature",
                                     0, "(m,m)->(m,m)");
                 """),
-                ], include_dirs=self.numpy_include, 
+                ], include_dirs=self.numpy_include,
                    prologue='''
                 #ifdef PYPY_VERSION
-                    #include <pypy_numpy.h>    
+                    #include <pypy_numpy.h>
                 #endif
                 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
                 #include <numpy/arrayobject.h>
@@ -479,7 +479,7 @@
                             res += +10;
                     *((float *)args[1]) = res;
                 };
-                            
+
                 ''',  more_init = '''
                 #ifndef PYPY_VERSION
                     import_array();
diff --git a/pypy/module/cpyext/test/test_pystate.py b/pypy/module/cpyext/test/test_pystate.py
--- a/pypy/module/cpyext/test/test_pystate.py
+++ b/pypy/module/cpyext/test/test_pystate.py
@@ -141,11 +141,10 @@
         module = self.import_extension('foo', [
                 ("test", "METH_NOARGS",
                  """
-                 return PyInt_FromLong(PyEval_ThreadsInitialized());
+                 return PyLong_FromLong(PyEval_ThreadsInitialized());
                  """),
                 ])
         res = module.test()
-        print "got", res
         assert res in (0, 1)
 
 


More information about the pypy-commit mailing list