This is an automated email from the ASF dual-hosted git repository.
alenka pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 5a1ca69d61 GH-37244: [Python] Remove support for pickle5 (#37644)
5a1ca69d61 is described below
commit 5a1ca69d617288a12769b279502d8815a859f487
Author: Chris Jordan-Squire <[email protected]>
AuthorDate: Tue Sep 12 07:02:17 2023 -0400
GH-37244: [Python] Remove support for pickle5 (#37644)
Resolve issue https://github.com/apache/arrow/issues/37244 by removing
pickle5 usage in pyarrow.
### Rationale for this change
See issue https://github.com/apache/arrow/issues/37244 .
### What changes are included in this PR?
pickle5 usage is removed from pyarrow .
### Are these changes tested?
Yes, the python test suite was run.
### Are there any user-facing changes?
No.
* Closes: #37244
Authored-by: Chris Jordan-Squire <[email protected]>
Signed-off-by: AlenkaF <[email protected]>
---
python/pyarrow/compat.pxi | 8 +-------
python/pyarrow/io.pxi | 3 ++-
python/pyarrow/pandas_compat.py | 5 +++--
python/pyarrow/types.pxi | 5 +++--
python/requirements-wheel-test.txt | 1 -
5 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/python/pyarrow/compat.pxi b/python/pyarrow/compat.pxi
index 98aa1f2433..8cf106d560 100644
--- a/python/pyarrow/compat.pxi
+++ b/python/pyarrow/compat.pxi
@@ -33,16 +33,10 @@ def encode_file_path(path):
ordered_dict = dict
-try:
- import pickle5 as builtin_pickle
-except ImportError:
- import pickle as builtin_pickle
-
-
try:
import cloudpickle as pickle
except ImportError:
- pickle = builtin_pickle
+ import pickle
def tobytes(o):
diff --git a/python/pyarrow/io.pxi b/python/pyarrow/io.pxi
index e3018ab470..460e932b86 100644
--- a/python/pyarrow/io.pxi
+++ b/python/pyarrow/io.pxi
@@ -21,6 +21,7 @@
from libc.stdlib cimport malloc, free
import codecs
+import pickle
import re
import sys
import threading
@@ -1368,7 +1369,7 @@ cdef class Buffer(_Weakrefable):
def __reduce_ex__(self, protocol):
if protocol >= 5:
- bufobj = builtin_pickle.PickleBuffer(self)
+ bufobj = pickle.PickleBuffer(self)
elif self.buffer.get().is_mutable():
# Need to pass a bytearray to recreate a mutable buffer when
# unpickling.
diff --git a/python/pyarrow/pandas_compat.py b/python/pyarrow/pandas_compat.py
index 12f1cc4312..4e5c868efd 100644
--- a/python/pyarrow/pandas_compat.py
+++ b/python/pyarrow/pandas_compat.py
@@ -26,13 +26,14 @@ from copy import deepcopy
from itertools import zip_longest
import json
import operator
+import pickle
import re
import warnings
import numpy as np
import pyarrow as pa
-from pyarrow.lib import _pandas_api, builtin_pickle, frombytes # noqa
+from pyarrow.lib import _pandas_api, frombytes # noqa
_logical_type_map = {}
@@ -720,7 +721,7 @@ def _reconstruct_block(item, columns=None,
extension_columns=None):
klass=_int.DatetimeTZBlock,
dtype=dtype)
elif 'object' in item:
- block = _int.make_block(builtin_pickle.loads(block_arr),
+ block = _int.make_block(pickle.loads(block_arr),
placement=placement)
elif 'py_array' in item:
# create ExtensionBlock
diff --git a/python/pyarrow/types.pxi b/python/pyarrow/types.pxi
index ffaebd2418..9f8b347d56 100644
--- a/python/pyarrow/types.pxi
+++ b/python/pyarrow/types.pxi
@@ -19,6 +19,7 @@ from cpython.pycapsule cimport PyCapsule_CheckExact,
PyCapsule_GetPointer
import atexit
from collections.abc import Mapping
+import pickle
import re
import sys
import warnings
@@ -1699,12 +1700,12 @@ cdef class PyExtensionType(ExtensionType):
.format(type(self).__name__))
def __arrow_ext_serialize__(self):
- return builtin_pickle.dumps(self)
+ return pickle.dumps(self)
@classmethod
def __arrow_ext_deserialize__(cls, storage_type, serialized):
try:
- ty = builtin_pickle.loads(serialized)
+ ty = pickle.loads(serialized)
except Exception:
# For some reason, it's impossible to deserialize the
# ExtensionType instance. Perhaps the serialized data is
diff --git a/python/requirements-wheel-test.txt
b/python/requirements-wheel-test.txt
index c23a30f70e..9de0acb754 100644
--- a/python/requirements-wheel-test.txt
+++ b/python/requirements-wheel-test.txt
@@ -1,7 +1,6 @@
cffi
cython
hypothesis
-pickle5; platform_system != "Windows" and python_version < "3.8"
pytest
pytest-lazy-fixture
pytz