cpython: 4c05e7c195ac (original) (raw)

Mercurial > cpython

changeset 99075:4c05e7c195ac 3.5

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:31:51 +0200
parents d1737db0f1b2(current diff)c8841db9433d(diff)
children a2f574896f49 2c9b5c5b54ae
files Lib/test/test_coroutines.py 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 7 files changed, 99 insertions(+), 0 deletions(-)[+] [-] Lib/test/test_coroutines.py 30 Lib/test/test_dictviews.py 18 Lib/test/test_generators.py 17 Lib/test/test_xml_etree.py 14 Lib/test/test_zlib.py 11 Misc/NEWS 3 Objects/typeobject.c 6

line wrap: on

line diff

--- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -1,5 +1,7 @@ import contextlib +import copy import inspect +import pickle import sys import types import unittest @@ -1318,6 +1320,34 @@ class CoroutineTest(unittest.TestCase): run_async(foo()) self.assertEqual(CNT, 0)

+

+

+

+ class CoroAsyncIOCompatTest(unittest.TestCase):

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

+

+ if name == "main": unittest.main()

--- 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 warnings @@ -111,6 +113,21 @@ class GeneratorTest(unittest.TestCase): self.assertEqual(gen.qualname, "GeneratorTest.test_name..")

+

+ class ExceptionTest(unittest.TestCase): # Tests for the issue #23353: check that the currently handled exception

--- 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 @@ -11,6 +11,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 @@ -4100,6 +4100,12 @@ reduce_newobj(PyObject *obj, int proto) PyObject *newobj, *newargs, *state, *listitems, *dictitems; PyObject *result;