diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-06-13 13:58:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-13 13:58:51 +0200 |
commit | 63ab4ba07b492448844940c347787ba30735b7f2 (patch) | |
tree | e76e84e6bd8355398833353bf9afdf6f2a1b6da8 /Lib/test/test_pickle.py | |
parent | 6f75c873752a16a7ad8f35855b1e29f59d048e84 (diff) | |
download | cpython-git-63ab4ba07b492448844940c347787ba30735b7f2.tar.gz |
bpo-37210: Fix pure Python pickle when _pickle is unavailable (GH-14016)
Allow pure Python implementation of pickle to work
even when the C _pickle module is unavailable.
Fix test_pickle when _pickle is missing: declare PyPicklerHookTests
outside "if has_c_implementation:" block.
Diffstat (limited to 'Lib/test/test_pickle.py')
-rw-r--r-- | Lib/test/test_pickle.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py index 5f7a879b93..2307b133db 100644 --- a/Lib/test/test_pickle.py +++ b/Lib/test/test_pickle.py @@ -203,6 +203,13 @@ class PyChainDispatchTableTests(AbstractDispatchTableTests): return collections.ChainMap({}, pickle.dispatch_table) +class PyPicklerHookTests(AbstractHookTests): + class CustomPyPicklerClass(pickle._Pickler, + AbstractCustomPicklerClass): + pass + pickler_class = CustomPyPicklerClass + + if has_c_implementation: class CPickleTests(AbstractPickleModuleTests): from _pickle import dump, dumps, load, loads, Pickler, Unpickler @@ -255,12 +262,6 @@ if has_c_implementation: def get_dispatch_table(self): return collections.ChainMap({}, pickle.dispatch_table) - class PyPicklerHookTests(AbstractHookTests): - class CustomPyPicklerClass(pickle._Pickler, - AbstractCustomPicklerClass): - pass - pickler_class = CustomPyPicklerClass - class CPicklerHookTests(AbstractHookTests): class CustomCPicklerClass(_pickle.Pickler, AbstractCustomPicklerClass): pass |