summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_cpickle.py32
-rw-r--r--Modules/cPickle.c4
2 files changed, 22 insertions, 14 deletions
diff --git a/Lib/test/test_cpickle.py b/Lib/test/test_cpickle.py
index 7f6c35a..7d3fc97 100644
--- a/Lib/test/test_cpickle.py
+++ b/Lib/test/test_cpickle.py
@@ -94,16 +94,28 @@ class Node(object):
pass
class cPickleDeepRecursive(unittest.TestCase):
- '''Issue 2702. This should raise a RecursionLimit but in some
- platforms (FreeBSD, win32) sometimes raises KeyError instead,
- or just silently terminates the interpreter (=crashes).
- '''
- def test_deep_recursive(self):
- nodes = [Node() for i in range(500)]
- for n in nodes:
- n.connections = list(nodes)
- n.connections.remove(n)
- self.assertRaises(RuntimeError, cPickle.dumps, n)
+# I commented out, because the patch that fixes this was reverted, as
+# it broke the next test case. Check the issues for full history.
+# def test_issue2702(self):
+# '''This should raise a RecursionLimit but in some
+# platforms (FreeBSD, win32) sometimes raises KeyError instead,
+# or just silently terminates the interpreter (=crashes).
+# '''
+# nodes = [Node() for i in range(500)]
+# for n in nodes:
+# n.connections = list(nodes)
+# n.connections.remove(n)
+# self.assertRaises(RuntimeError, cPickle.dumps, n)
+
+ def test_issue3179(self):
+ '''Safe test, because of I broken this case when fixing the
+ behaviour for the previous test.
+ '''
+ res=[]
+ for x in range(1,2000):
+ res.append(dict(doc=x, similar=[]))
+ cPickle.dumps(res)
+
def test_main():
test_support.run_unittest(
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 98a2b87..afa75fd 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -1523,8 +1523,6 @@ batch_list(Picklerobject *self, PyObject *iter)
static char append = APPEND;
static char appends = APPENDS;
- self->nesting++;
-
assert(iter != NULL);
if (self->proto == 0) {
@@ -1664,8 +1662,6 @@ batch_dict(Picklerobject *self, PyObject *iter)
static char setitem = SETITEM;
static char setitems = SETITEMS;
- self->nesting++;
-
assert(iter != NULL);
if (self->proto == 0) {