summaryrefslogtreecommitdiff
blob: 58c301e4d04f8adde964d4d52518018ac72d637b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
changeset:   55598:4ec2a5b49386
tag:         tip
user:        Armin Rigo <arigo@tunes.org>
date:        Mon Jun 11 19:54:04 2012 +0200
summary:     Test and fix (thanks marienz)

diff -r cdb2d1b3d0da -r 4ec2a5b49386 pypy/module/cpyext/object.py
--- a/pypy/module/cpyext/object.py	Mon Jun 11 19:41:35 2012 +0200
+++ b/pypy/module/cpyext/object.py	Mon Jun 11 19:54:04 2012 +0200
@@ -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 -r cdb2d1b3d0da -r 4ec2a5b49386 pypy/module/cpyext/test/test_object.py
--- a/pypy/module/cpyext/test/test_object.py	Mon Jun 11 19:41:35 2012 +0200
+++ b/pypy/module/cpyext/test/test_object.py	Mon Jun 11 19:54:04 2012 +0200
@@ -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;
                  """)])