[Python-checkins] cpython (2.7): Comment out two tests that won't pass now after reverting the typeobject.c

barry.warsaw python-checkins at python.org
Mon Jan 11 14:45:04 EST 2016


https://hg.python.org/cpython/rev/6081db594907
changeset:   99851:6081db594907
branch:      2.7
user:        Barry Warsaw <barry at python.org>
date:        Mon Jan 11 14:44:59 2016 -0500
summary:
  Comment out two tests that won't pass now after reverting the typeobject.c
change.  Also, as per further discussion, we'll just remove the regressing
code in typeobject.c

files:
  Lib/test/test_buffer.py     |  11 ++++++-----
  Lib/test/test_memoryview.py |  11 ++++++-----
  Misc/NEWS                   |   2 +-
  Objects/typeobject.c        |  24 ------------------------
  4 files changed, 13 insertions(+), 35 deletions(-)


diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py
--- a/Lib/test/test_buffer.py
+++ b/Lib/test/test_buffer.py
@@ -42,11 +42,12 @@
         with self.assertRaises(TypeError):
             copy.copy(buf)
 
-    def test_pickle(self):
-        buf = buffer(b'abc')
-        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
-            with self.assertRaises(TypeError):
-                pickle.dumps(buf, proto)
+    # See issue #22995
+    ## def test_pickle(self):
+    ##     buf = buffer(b'abc')
+    ##     for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+    ##         with self.assertRaises(TypeError):
+    ##             pickle.dumps(buf, proto)
 
 
 def test_main():
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py
--- a/Lib/test/test_memoryview.py
+++ b/Lib/test/test_memoryview.py
@@ -362,11 +362,12 @@
         with self.assertRaises(TypeError):
             copy.copy(m)
 
-    def test_pickle(self):
-        m = memoryview(b'abc')
-        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
-            with self.assertRaises(TypeError):
-                pickle.dumps(m, proto)
+    # See issue #22995
+    ## def test_pickle(self):
+    ##     m = memoryview(b'abc')
+    ##     for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+    ##         with self.assertRaises(TypeError):
+    ##             pickle.dumps(m, proto)
 
 
 def test_main():
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,7 +10,7 @@
 Core and Builtins
 -----------------
 
-- Issue #22995: [UPDATE] Comment out the one of the pickleability tests in
+- Issue #22995: [UPDATE] Remove the one of the pickleability tests in
   _PyObject_GetState() due to regressions observed in Cython-based projects.
 
 - Issue #25961: Disallowed null characters in the type name.
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -3279,30 +3279,6 @@
         if (names == NULL)
             goto end;
         assert(names == Py_None || PyList_Check(names));
-#if 0
-        /* 2016-01-11 barry - This clause breaks at least three packages which
-           rely on Cython: kivy, pysam, and s3ql.  Cython may be doing
-           something funny under the hood, but as this is clearly a regression
-           and the rationale for this prohibition is suspect, I am commenting
-           this out.  Perhaps it should just be removed.  See issue #22995 for
-           details.
-        */
-        if (required_state) {
-            Py_ssize_t basicsize = PyBaseObject_Type.tp_basicsize;
-            if (obj->ob_type->tp_dictoffset)
-                basicsize += sizeof(PyObject *);
-            if (obj->ob_type->tp_weaklistoffset)
-                basicsize += sizeof(PyObject *);
-            if (names != Py_None)
-                basicsize += sizeof(PyObject *) * Py_SIZE(names);
-            if (obj->ob_type->tp_basicsize > basicsize) {
-                PyErr_Format(PyExc_TypeError,
-                             "can't pickle %.200s objects",
-                             Py_TYPE(obj)->tp_name);
-                goto end;
-            }
-        }
-#endif
 
         if (names != Py_None) {
             slots = PyDict_New();

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list