[pypy-commit] pypy cpyext-ext: check return values in tests

mattip pypy.commits at gmail.com
Tue May 31 17:16:16 EDT 2016


Author: Matti Picus <matti.picus at gmail.com>
Branch: cpyext-ext
Changeset: r84852:0682d9184a3c
Date: 2016-05-31 23:54 +0300
http://bitbucket.org/pypy/pypy/changeset/0682d9184a3c/

Log:	check return values in tests

diff --git a/pypy/module/cpyext/test/test_bytearrayobject.py b/pypy/module/cpyext/test/test_bytearrayobject.py
--- a/pypy/module/cpyext/test/test_bytearrayobject.py
+++ b/pypy/module/cpyext/test/test_bytearrayobject.py
@@ -99,6 +99,8 @@
             ("getbytearray", "METH_NOARGS",
              """
                  PyObject* s1 = PyByteArray_FromStringAndSize("test", 4);
+                 if (s1 == NULL)
+                     return NULL;
                  char* c = PyByteArray_AsString(s1);
                  PyObject* s2 = PyByteArray_FromStringAndSize(c, 4);
                  Py_DECREF(s1);
@@ -151,6 +153,8 @@
              }
              
              ba = PyByteArray_FromObject(obj);
+             if (ba == NULL)
+                 return NULL;
              oldsize = PyByteArray_Size(ba);
              if (oldsize == 0)
              {


More information about the pypy-commit mailing list