Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/loky/files/, dev-python/loky/
Date: Thu, 02 Jul 2020 12:43:05
Message-Id: 1593693769.cc9f77e7cb0fe3de5c8bf85b9dc41648c2dbf3e0.mgorny@gentoo
1 commit: cc9f77e7cb0fe3de5c8bf85b9dc41648c2dbf3e0
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jul 2 11:43:08 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 2 12:42:49 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cc9f77e7
7
8 dev-python/loky: Add a patch for cloudpickle-1.5+
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 .../loky/files/loky-2.8.0-cloudpickle-1.5.patch | 39 ++++++++++++++++++++++
13 .../{loky-2.8.0.ebuild => loky-2.8.0-r1.ebuild} | 7 ++--
14 2 files changed, 43 insertions(+), 3 deletions(-)
15
16 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
17 new file mode 100644
18 index 00000000000..05fb70455f0
19 --- /dev/null
20 +++ b/dev-python/loky/files/loky-2.8.0-cloudpickle-1.5.patch
21 @@ -0,0 +1,39 @@
22 +From 0e930389f4785f9d311b090f92057563e22b9768 Mon Sep 17 00:00:00 2001
23 +From: tomMoral <thomas.moreau.2010@×××××.com>
24 +Date: Thu, 2 Jul 2020 13:37:14 +0200
25 +Subject: [PATCH] FIX cloudpickle customization mechanism
26 +
27 +---
28 + loky/backend/reduction.py | 12 ++++++++----
29 + 1 file changed, 8 insertions(+), 4 deletions(-)
30 +
31 +diff --git a/loky/backend/reduction.py b/loky/backend/reduction.py
32 +index 0bad5f63..d87fbdff 100644
33 +--- a/loky/backend/reduction.py
34 ++++ b/loky/backend/reduction.py
35 +@@ -189,6 +189,10 @@ def __init__(self, writer, reducers=None, protocol=HIGHEST_PROTOCOL):
36 + self.dispatch = self._dispatch.copy()
37 + else:
38 + if getattr(self, "dispatch_table", None) is not None:
39 ++ # Make sure dispatch table is an instance level field
40 ++ # as it is not the case for isntance for cloudpickle1.5+
41 ++ # see joblib/loky#259
42 ++ self.dispatch_table = self.dispatch_table.copy()
43 + self.dispatch_table.update(self._dispatch_table.copy())
44 + else:
45 + self.dispatch_table = self._dispatch_table.copy()
46 +@@ -202,10 +206,10 @@ def register(self, type, reduce_func):
47 + if sys.version_info < (3,):
48 + # Python 2 pickler dispatching is not explicitly customizable.
49 + # Let us use a closure to workaround this limitation.
50 +- def dispatcher(self, obj):
51 +- reduced = reduce_func(obj)
52 +- self.save_reduce(obj=obj, *reduced)
53 +- self.dispatch[type] = dispatcher
54 ++ def dispatcher(self, obj):
55 ++ reduced = reduce_func(obj)
56 ++ self.save_reduce(obj=obj, *reduced)
57 ++ self.dispatch[type] = dispatcher
58 + else:
59 + self.dispatch_table[type] = reduce_func
60 +
61
62 diff --git a/dev-python/loky/loky-2.8.0.ebuild b/dev-python/loky/loky-2.8.0-r1.ebuild
63 similarity index 86%
64 rename from dev-python/loky/loky-2.8.0.ebuild
65 rename to dev-python/loky/loky-2.8.0-r1.ebuild
66 index 6d84a226623..ba05e5dcaaa 100644
67 --- a/dev-python/loky/loky-2.8.0.ebuild
68 +++ b/dev-python/loky/loky-2.8.0-r1.ebuild
69 @@ -25,13 +25,14 @@ BDEPEND="
70
71 distutils_enable_tests pytest
72
73 +PATCHES=(
74 + "${FILESDIR}"/${P}-cloudpickle-1.5.patch
75 +)
76 +
77 src_prepare() {
78 # docker, seriously?
79 sed -e 's:test_cpu_count_cfs_limit:_&:' \
80 -i tests/test_loky_module.py || die
81 - # suddenly started failing :-(
82 - sed -e 's:test_serialization:_&:' \
83 - -i tests/_test_process_executor.py || die
84
85 distutils-r1_src_prepare
86 }