[pypy-commit] pypy cpyext-bootstrap: This test checks a condition which is actually not true, but which

arigo pypy.commits at gmail.com
Wed Jan 27 10:37:04 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: cpyext-bootstrap
Changeset: r81972:dd3a1abe4374
Date: 2016-01-27 16:35 +0100
http://bitbucket.org/pypy/pypy/changeset/dd3a1abe4374/

Log:	This test checks a condition which is actually not true, but which
	happened to be true due to the two versions of some PyTypeObjects
	which this branch removes. The condition is false e.g. after
	translation anyway.

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
@@ -374,6 +374,11 @@
         module = self.import_extension('foo', [
             ("test_type", "METH_O",
              '''
+                 /* "args->ob_type" is a strange way to get at 'type',
+                    which should have a different tp_getattro/tp_setattro
+                    than its tp_base, which is 'object'.
+                  */
+                  
                  if (!args->ob_type->tp_setattro)
                  {
                      PyErr_SetString(PyExc_ValueError, "missing tp_setattro");
@@ -382,8 +387,12 @@
                  if (args->ob_type->tp_setattro ==
                      args->ob_type->tp_base->tp_setattro)
                  {
-                     PyErr_SetString(PyExc_ValueError, "recursive tp_setattro");
-                     return NULL;
+                     /* Note that unlike CPython, in PyPy 'type.tp_setattro'
+                        is the same function as 'object.tp_setattro'.  This
+                        test used to check that it was not, but that was an
+                        artifact of the bootstrap logic only---in the final
+                        C sources I checked and they are indeed the same.
+                        So we ignore this problem here. */
                  }
                  if (!args->ob_type->tp_getattro)
                  {


More information about the pypy-commit mailing list