Author: mattip <matti.pi...@gmail.com> Branch: cpyext-ext Changeset: r83442:425af52a45be Date: 2016-03-30 23:52 +0300 http://bitbucket.org/pypy/pypy/changeset/425af52a45be/
Log: fix tests for -A diff --git a/pypy/module/cpyext/test/test_bytesobject.py b/pypy/module/cpyext/test/test_bytesobject.py --- a/pypy/module/cpyext/test/test_bytesobject.py +++ b/pypy/module/cpyext/test/test_bytesobject.py @@ -33,12 +33,14 @@ } #ifdef PYPY_VERSION expected_size = sizeof(void*)*7; + #elif defined Py_DEBUG + expected_size = 53; #else expected_size = 37; #endif if(s->ob_type->tp_basicsize != expected_size) { - printf("tp_basicsize==%d\\n", s->ob_type->tp_basicsize); + printf("tp_basicsize==%ld\\n", s->ob_type->tp_basicsize); result = 0; } Py_DECREF(s); diff --git a/pypy/module/cpyext/test/test_object.py b/pypy/module/cpyext/test/test_object.py --- a/pypy/module/cpyext/test/test_object.py +++ b/pypy/module/cpyext/test/test_object.py @@ -241,13 +241,14 @@ copy = PyObject_REALLOC(orig, 15); if (copy == NULL) Py_RETURN_NONE; - ret = PyString_FromString(copy, 12); + ret = PyString_FromStringAndSize(copy, 12); + if (copy != orig) + PyObject_Free(copy); PyObject_Free(orig); - PyObject_Free(copy); return ret; """)]) x = module.realloctest() - assert x == 'hello world' + assert x == 'hello world\x00' def test_TypeCheck(self): module = self.import_extension('foo', [ @@ -430,7 +431,7 @@ PyBuffer_Release(&buf); Py_RETURN_NONE; """)]) - raises(ValueError, module.fillinfo) + raises((BufferError, ValueError), module.fillinfo) class AppTestPyBuffer_Release(AppTestCpythonExtensionBase): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit