cpython: c8841db9433d (original) (raw)

Mercurial > cpython

changeset 99074:c8841db9433d 3.4

Issue #22995: Default implementation of __reduce__ and __reduce_ex__ now rejects builtin types with not defined __new__. Added tests for non-pickleable types. [#22995]

Serhiy Storchaka storchaka@gmail.com
date Thu, 12 Nov 2015 11:23:04 +0200
parents 56f64ec9259f
children 4c05e7c195ac 515ebfbb4e67
files Lib/test/test_dictviews.py Lib/test/test_generators.py Lib/test/test_xml_etree.py Lib/test/test_zlib.py Misc/NEWS Objects/typeobject.c
diffstat 6 files changed, 78 insertions(+), 0 deletions(-)[+] [-] Lib/test/test_dictviews.py 18 Lib/test/test_generators.py 20 Lib/test/test_xml_etree.py 14 Lib/test/test_zlib.py 11 Misc/NEWS 3 Objects/typeobject.c 12

line wrap: on

line diff

--- a/Lib/test/test_dictviews.py +++ b/Lib/test/test_dictviews.py @@ -1,3 +1,5 @@ +import copy +import pickle import unittest from test import support @@ -198,6 +200,22 @@ class DictSetTest(unittest.TestCase): d[42] = d.values() self.assertRaises(RuntimeError, repr, d)

+

+ def test_main(): support.run_unittest(DictSetTest)

--- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -1,4 +1,6 @@ +import copy import gc +import pickle import sys import unittest import weakref @@ -70,6 +72,24 @@ class FinalizationTest(unittest.TestCase self.assertEqual(cm.exception.value, 2) +class GeneratorTest(unittest.TestCase): +

+

+ + class ExceptionTest(unittest.TestCase): # Tests for the issue #23353: check that the currently handled exception # is correctly saved/restored in PyEval_EvalFrameEx().

--- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -5,6 +5,7 @@

For this purpose, the module-level "ET" symbol is temporarily

monkey-patched when running the "test_xml_etree_c" test suite.

+import copy import html import io import operator @@ -2082,6 +2083,19 @@ class ElementIterTest(unittest.TestCase) self.assertEqual(self._ilist(doc), all_tags) self.assertEqual(self._ilist(doc, '*'), all_tags)

+

+ class TreeBuilderTest(unittest.TestCase): sample1 = ('<!DOCTYPE html PUBLIC'

--- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -1,6 +1,7 @@ import unittest from test import support import binascii +import pickle import random import sys from test.support import bigmemtest, _1G, _4G @@ -600,6 +601,16 @@ class CompressObjectTestCase(BaseCompres d.flush() self.assertRaises(ValueError, d.copy)

+

+ # Memory use of the following functions takes into account overallocation @bigmemtest(size=_1G + 1024 * 1024, memuse=3)

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Release date: tba Core and Builtins ----------------- +- Issue #22995: Default implementation of reduce and reduce_ex now

--- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3980,6 +3980,12 @@ reduce_4(PyObject *obj) PyObject *result; _Py_IDENTIFIER(newobj_ex);