From 07a16289543e78d25b66257c9e06a0578c92b59c Mon Sep 17 00:00:00 2001 From: pnhekgfuf <1913997697@qq.com> Date: Sat, 29 Apr 2023 12:18:01 +0800 Subject: [PATCH] ADD file via upload --- Scrapy-Redis-Zhihu/scrapy_redis/picklecompat.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Scrapy-Redis-Zhihu/scrapy_redis/picklecompat.py diff --git a/Scrapy-Redis-Zhihu/scrapy_redis/picklecompat.py b/Scrapy-Redis-Zhihu/scrapy_redis/picklecompat.py new file mode 100644 index 0000000..a8d85c0 --- /dev/null +++ b/Scrapy-Redis-Zhihu/scrapy_redis/picklecompat.py @@ -0,0 +1,14 @@ +"""A pickle wrapper module with protocol=-1 by default.""" + +try: + import cPickle as pickle # PY2 +except ImportError: + import pickle + + +def loads(s): + return pickle.loads(s) + + +def dumps(obj): + return pickle.dumps(obj, protocol=-1)