summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-07-02 13:43:08 +0200
committerMichał Górny <mgorny@gentoo.org>2020-07-02 14:42:49 +0200
commitcc9f77e7cb0fe3de5c8bf85b9dc41648c2dbf3e0 (patch)
treef708d3750000dc24a79a63a2dafc9efc03f8f5d4 /dev-python/loky
parentsys-libs/libsemanage: revbump for python fixes (diff)
downloadgentoo-cc9f77e7cb0fe3de5c8bf85b9dc41648c2dbf3e0.tar.gz
gentoo-cc9f77e7cb0fe3de5c8bf85b9dc41648c2dbf3e0.tar.bz2
gentoo-cc9f77e7cb0fe3de5c8bf85b9dc41648c2dbf3e0.zip
dev-python/loky: Add a patch for cloudpickle-1.5+
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/loky')
-rw-r--r--dev-python/loky/files/loky-2.8.0-cloudpickle-1.5.patch39
-rw-r--r--dev-python/loky/loky-2.8.0-r1.ebuild (renamed from dev-python/loky/loky-2.8.0.ebuild)7
2 files changed, 43 insertions, 3 deletions
diff --git a/dev-python/loky/files/loky-2.8.0-cloudpickle-1.5.patch b/dev-python/loky/files/loky-2.8.0-cloudpickle-1.5.patch
new file mode 100644
index 000000000000..05fb70455f0a
--- /dev/null
+++ b/dev-python/loky/files/loky-2.8.0-cloudpickle-1.5.patch
@@ -0,0 +1,39 @@
+From 0e930389f4785f9d311b090f92057563e22b9768 Mon Sep 17 00:00:00 2001
+From: tomMoral <thomas.moreau.2010@gmail.com>
+Date: Thu, 2 Jul 2020 13:37:14 +0200
+Subject: [PATCH] FIX cloudpickle customization mechanism
+
+---
+ loky/backend/reduction.py | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/loky/backend/reduction.py b/loky/backend/reduction.py
+index 0bad5f63..d87fbdff 100644
+--- a/loky/backend/reduction.py
++++ b/loky/backend/reduction.py
+@@ -189,6 +189,10 @@ def __init__(self, writer, reducers=None, protocol=HIGHEST_PROTOCOL):
+ self.dispatch = self._dispatch.copy()
+ else:
+ if getattr(self, "dispatch_table", None) is not None:
++ # Make sure dispatch table is an instance level field
++ # as it is not the case for isntance for cloudpickle1.5+
++ # see joblib/loky#259
++ self.dispatch_table = self.dispatch_table.copy()
+ self.dispatch_table.update(self._dispatch_table.copy())
+ else:
+ self.dispatch_table = self._dispatch_table.copy()
+@@ -202,10 +206,10 @@ def register(self, type, reduce_func):
+ if sys.version_info < (3,):
+ # Python 2 pickler dispatching is not explicitly customizable.
+ # Let us use a closure to workaround this limitation.
+- def dispatcher(self, obj):
+- reduced = reduce_func(obj)
+- self.save_reduce(obj=obj, *reduced)
+- self.dispatch[type] = dispatcher
++ def dispatcher(self, obj):
++ reduced = reduce_func(obj)
++ self.save_reduce(obj=obj, *reduced)
++ self.dispatch[type] = dispatcher
+ else:
+ self.dispatch_table[type] = reduce_func
+
diff --git a/dev-python/loky/loky-2.8.0.ebuild b/dev-python/loky/loky-2.8.0-r1.ebuild
index 6d84a226623a..ba05e5dcaaab 100644
--- a/dev-python/loky/loky-2.8.0.ebuild
+++ b/dev-python/loky/loky-2.8.0-r1.ebuild
@@ -25,13 +25,14 @@ BDEPEND="
distutils_enable_tests pytest
+PATCHES=(
+ "${FILESDIR}"/${P}-cloudpickle-1.5.patch
+)
+
src_prepare() {
# docker, seriously?
sed -e 's:test_cpu_count_cfs_limit:_&:' \
-i tests/test_loky_module.py || die
- # suddenly started failing :-(
- sed -e 's:test_serialization:_&:' \
- -i tests/_test_process_executor.py || die
distutils-r1_src_prepare
}