Author: Manuel Jacob <m...@manueljacob.de> Branch: py3.5 Changeset: r90499:c402f2a419e6 Date: 2017-03-02 22:07 +0100 http://bitbucket.org/pypy/pypy/changeset/c402f2a419e6/
Log: (mjacob, stevie) Try to fix pickle tests in lib- python/3/test/test_descr.py. diff --git a/pypy/objspace/std/objectobject.py b/pypy/objspace/std/objectobject.py --- a/pypy/objspace/std/objectobject.py +++ b/pypy/objspace/std/objectobject.py @@ -27,6 +27,9 @@ # and raises a TypeError if the condition holds true, this is done # just before reduce_2 is called in pypy state = getattr(obj, "__dict__", None) + # CPython returns None if the dict is empty + if state is not None and len(state) == 0: + state = None names = slotnames(cls) # not checking for list if names is not None: slots = {} diff --git a/pypy/objspace/std/test/test_obj.py b/pypy/objspace/std/test/test_obj.py --- a/pypy/objspace/std/test/test_obj.py +++ b/pypy/objspace/std/test/test_obj.py @@ -89,6 +89,11 @@ assert '__getnewargs__' not in seen assert '__getnewargs_ex__' not in seen + def test_reduce_state_empty_dict(self): + class X(object): + pass + assert X().__reduce_ex__(2)[2] is None + def test_default_format(self): class x(object): def __str__(self): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit