Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r84246:7d2a931a40e7 Date: 2016-05-06 08:49 +0200 http://bitbucket.org/pypy/pypy/changeset/7d2a931a40e7/
Log: merge heads diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -68,3 +68,12 @@ CPython). .. branch: oefmt + +.. branch: cpyext-werror + +Compile c snippets with -Werror in cpyext + +.. branch: gc-del-3 + +Add rgc.FinalizerQueue, documented in pypy/doc/discussion/finalizer-order.rst. +It is a more flexible way to make RPython finalizers. diff --git a/pypy/module/cpyext/ndarrayobject.py b/pypy/module/cpyext/ndarrayobject.py --- a/pypy/module/cpyext/ndarrayobject.py +++ b/pypy/module/cpyext/ndarrayobject.py @@ -248,7 +248,7 @@ w_signature = rffi.charp2str(signature) return do_ufunc(space, funcs, data, types, ntypes, nin, nout, identity, name, doc, check_return, w_signature) - + def do_ufunc(space, funcs, data, types, ntypes, nin, nout, identity, name, doc, check_return, w_signature): diff --git a/pypy/module/cpyext/test/test_borrow.py b/pypy/module/cpyext/test/test_borrow.py --- a/pypy/module/cpyext/test/test_borrow.py +++ b/pypy/module/cpyext/test/test_borrow.py @@ -12,13 +12,13 @@ PyObject *t = PyTuple_New(1); PyObject *f = PyFloat_FromDouble(42.0); PyObject *g = NULL; - printf("Refcnt1: %i\\n", f->ob_refcnt); + printf("Refcnt1: %zd\\n", f->ob_refcnt); PyTuple_SetItem(t, 0, f); // steals reference - printf("Refcnt2: %i\\n", f->ob_refcnt); + printf("Refcnt2: %zd\\n", f->ob_refcnt); f = PyTuple_GetItem(t, 0); // borrows reference - printf("Refcnt3: %i\\n", f->ob_refcnt); + printf("Refcnt3: %zd\\n", f->ob_refcnt); g = PyTuple_GetItem(t, 0); // borrows reference again - printf("Refcnt4: %i\\n", f->ob_refcnt); + printf("Refcnt4: %zd\\n", f->ob_refcnt); printf("COMPARE: %i\\n", f == g); fflush(stdout); Py_DECREF(t); 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 @@ -162,7 +162,10 @@ module = self.import_extension('foo', [ ("string_None", "METH_VARARGS", ''' - return PyString_AsString(Py_None); + if (PyString_AsString(Py_None)) { + Py_RETURN_NONE; + } + return NULL; ''' )]) raises(TypeError, module.string_None) diff --git a/pypy/module/cpyext/test/test_classobject.py b/pypy/module/cpyext/test/test_classobject.py --- a/pypy/module/cpyext/test/test_classobject.py +++ b/pypy/module/cpyext/test/test_classobject.py @@ -29,7 +29,6 @@ assert space.unwrap(space.getattr(w_instance, space.wrap('x'))) == 1 assert space.unwrap(space.getattr(w_instance, space.wrap('y'))) == 2 assert space.unwrap(space.getattr(w_instance, space.wrap('args'))) == (3,) - def test_lookup(self, space, api): w_instance = space.appexec([], """(): @@ -68,7 +67,7 @@ ("get_classtype", "METH_NOARGS", """ Py_INCREF(&PyClass_Type); - return &PyClass_Type; + return (PyObject*)&PyClass_Type; """)]) class C: pass assert module.get_classtype() is type(C) diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py --- a/pypy/module/cpyext/test/test_cpyext.py +++ b/pypy/module/cpyext/test/test_cpyext.py @@ -72,8 +72,7 @@ else: kwds["link_files"] = [str(api_library + '.so')] if sys.platform.startswith('linux'): - kwds["compile_extra"]=["-Werror=implicit-function-declaration", - "-g", "-O0"] + kwds["compile_extra"]=["-Werror", "-g", "-O0"] kwds["link_extra"]=["-g"] modname = modname.split('.')[-1] @@ -747,7 +746,7 @@ refcnt_after = true_obj->ob_refcnt; Py_DECREF(true_obj); Py_DECREF(true_obj); - fprintf(stderr, "REFCNT %i %i\\n", refcnt, refcnt_after); + fprintf(stderr, "REFCNT %zd %zd\\n", refcnt, refcnt_after); return PyBool_FromLong(refcnt_after == refcnt + 2); } static PyObject* foo_bar(PyObject* self, PyObject *args) @@ -763,7 +762,7 @@ return NULL; refcnt_after = true_obj->ob_refcnt; Py_DECREF(tup); - fprintf(stderr, "REFCNT2 %i %i %i\\n", refcnt, refcnt_after, + fprintf(stderr, "REFCNT2 %zd %zd %zd\\n", refcnt, refcnt_after, true_obj->ob_refcnt); return PyBool_FromLong(refcnt_after == refcnt + 1 && refcnt == true_obj->ob_refcnt); diff --git a/pypy/module/cpyext/test/test_longobject.py b/pypy/module/cpyext/test/test_longobject.py --- a/pypy/module/cpyext/test/test_longobject.py +++ b/pypy/module/cpyext/test/test_longobject.py @@ -171,7 +171,7 @@ int little_endian, is_signed; if (!PyArg_ParseTuple(args, "ii", &little_endian, &is_signed)) return NULL; - return _PyLong_FromByteArray("\x9A\xBC", 2, + return _PyLong_FromByteArray((unsigned char*)"\x9A\xBC", 2, little_endian, is_signed); """), ]) @@ -187,7 +187,7 @@ int little_endian, is_signed; if (!PyArg_ParseTuple(args, "ii", &little_endian, &is_signed)) return NULL; - return _PyLong_FromByteArray("\x9A\xBC\x41", 3, + return _PyLong_FromByteArray((unsigned char*)"\x9A\xBC\x41", 3, little_endian, is_signed); """), ]) diff --git a/pypy/module/cpyext/test/test_pyerrors.py b/pypy/module/cpyext/test/test_pyerrors.py --- a/pypy/module/cpyext/test/test_pyerrors.py +++ b/pypy/module/cpyext/test/test_pyerrors.py @@ -168,14 +168,14 @@ PyErr_NormalizeException(&type, &val, &tb); if (type != PyExc_TypeError) Py_RETURN_FALSE; - if (val->ob_type != PyExc_TypeError) + if ((PyObject*)Py_TYPE(val) != PyExc_TypeError) Py_RETURN_FALSE; /* Normalize again */ PyErr_NormalizeException(&type, &val, &tb); if (type != PyExc_TypeError) Py_RETURN_FALSE; - if (val->ob_type != PyExc_TypeError) + if ((PyObject*)Py_TYPE(val) != PyExc_TypeError) Py_RETURN_FALSE; PyErr_Restore(type, val, tb); diff --git a/pypy/module/cpyext/test/test_typeobject.py b/pypy/module/cpyext/test/test_typeobject.py --- a/pypy/module/cpyext/test/test_typeobject.py +++ b/pypy/module/cpyext/test/test_typeobject.py @@ -437,14 +437,14 @@ ("test_tp_getattro", "METH_VARARGS", ''' PyObject *name, *obj = PyTuple_GET_ITEM(args, 0); - PyIntObject *attr, *value = PyTuple_GET_ITEM(args, 1); + PyIntObject *attr, *value = (PyIntObject*) PyTuple_GET_ITEM(args, 1); if (!obj->ob_type->tp_getattro) { PyErr_SetString(PyExc_ValueError, "missing tp_getattro"); return NULL; } name = PyString_FromString("attr1"); - attr = obj->ob_type->tp_getattro(obj, name); + attr = (PyIntObject*) obj->ob_type->tp_getattro(obj, name); if (attr->ob_ival != value->ob_ival) { PyErr_SetString(PyExc_ValueError, @@ -454,7 +454,7 @@ Py_DECREF(name); Py_DECREF(attr); name = PyString_FromString("attr2"); - attr = obj->ob_type->tp_getattro(obj, name); + attr = (PyIntObject*) obj->ob_type->tp_getattro(obj, name); if (attr == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); @@ -758,8 +758,9 @@ } IntLikeObject; static int - intlike_nb_nonzero(IntLikeObject *v) + intlike_nb_nonzero(PyObject *o) { + IntLikeObject *v = (IntLikeObject*)o; if (v->value == -42) { PyErr_SetNone(PyExc_ValueError); return -1; diff --git a/pypy/tool/release/repackage.sh b/pypy/tool/release/repackage.sh --- a/pypy/tool/release/repackage.sh +++ b/pypy/tool/release/repackage.sh @@ -3,7 +3,7 @@ min=1 rev=1 branchname=release-$maj.x # ==OR== release-$maj.$min.x -tagname=release-$maj.$min # ==OR== release-$maj.$min.$rev +tagname=release-$maj.$min.$rev # ==OR== release-$maj.$min hg log -r $branchname || exit 1 hg log -r $tagname || exit 1 _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit