File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 9
9
import sys
10
10
import time
11
11
import traceback
12
- import types
13
12
import warnings
14
13
from contextlib import suppress
15
14
@@ -497,17 +496,16 @@ def goal(_):
497
496
return False
498
497
499
498
if executor is None :
500
- if isinstance (learner .function , types .LambdaType ):
501
- raise ValueError (
502
- "A lambda function cannot be pickled and "
503
- "therefore doesn't work with the default executor."
504
- "Either do not use a lamdba or use a framework that"
505
- " allows this, e.g. `ipyparallel` with `dill`."
506
- )
507
499
try :
508
500
pickle .dumps (learner .function )
509
501
except pickle .PicklingError :
510
- raise ValueError ("`learner.function` needs to be pickleble." )
502
+ raise ValueError (
503
+ "`learner.function` cannot be pickled (is it a lamdba function?)"
504
+ " and therefore does not work with the default executor."
505
+ " Either make sure the function is pickleble or use an executor"
506
+ " that might work with 'hard to pickle'-functions"
507
+ " , e.g. `ipyparallel` with `dill`."
508
+ )
511
509
512
510
super ().__init__ (
513
511
learner ,
You can’t perform that action at this time.
0 commit comments