Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r55598:4ec2a5b49386
Date: 2012-06-11 19:54 +0200
http://bitbucket.org/pypy/pypy/changeset/4ec2a5b49386/

Log:    Test and fix (thanks marienz)

diff --git a/pypy/module/cpyext/object.py b/pypy/module/cpyext/object.py
--- a/pypy/module/cpyext/object.py
+++ b/pypy/module/cpyext/object.py
@@ -489,3 +489,4 @@
     provides a subset of CPython's behavior.
     """
     Py_DecRef(space, view.c_obj)
+    view.c_obj = lltype.nullptr(PyObject.TO)
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
@@ -363,6 +363,10 @@
      * Py_buffer and the string should be released as well.
      */
     PyBuffer_Release(&buf);
+    assert(!buf.obj);
+    PyBuffer_Release(&buf);   /* call again, should not have any more effect */
+    PyBuffer_Release(&buf);
+    PyBuffer_Release(&buf);
 
     Py_RETURN_NONE;
                  """)])
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to