From 6a9db13ab5d15e99d6fb3aa8ec4f08988be974e6 Mon Sep 17 00:00:00 2001
From: GaelVaroquaux <gael.varoquaux@normalesup.org>
Date: Wed, 20 Aug 2014 10:49:25 +0200
Subject: [PATCH] MAINT: update joblib to latest release 0.8.3

---
 sklearn/externals/joblib/__init__.py |  2 +-
 sklearn/externals/joblib/parallel.py | 19 ++++++++++++++-----
 sklearn/externals/joblib/pool.py     |  4 +++-
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/sklearn/externals/joblib/__init__.py b/sklearn/externals/joblib/__init__.py
index 39c7fdf2e2..6b2f73e46e 100644
--- a/sklearn/externals/joblib/__init__.py
+++ b/sklearn/externals/joblib/__init__.py
@@ -100,7 +100,7 @@ Main features
 
 """
 
-__version__ = '0.8.2'
+__version__ = '0.8.3'
 
 
 from .memory import Memory, MemorizedResult
diff --git a/sklearn/externals/joblib/parallel.py b/sklearn/externals/joblib/parallel.py
index e7a5b0b945..c04e46fd55 100644
--- a/sklearn/externals/joblib/parallel.py
+++ b/sklearn/externals/joblib/parallel.py
@@ -103,12 +103,21 @@ class SafeFunction(object):
 
 
 ###############################################################################
-def delayed(function):
-    """ Decorator used to capture the arguments of a function.
+def delayed(function, check_pickle=True):
+    """Decorator used to capture the arguments of a function.
+
+    Pass `check_pickle=False` when:
+
+    - performing a possibly repeated check is too costly and has been done
+      already once outside of the call to delayed.
+
+    - when used in conjunction `Parallel(backend='threading')`.
+
     """
     # Try to pickle the input function, to catch the problems early when
-    # using with multiprocessing
-    pickle.dumps(function)
+    # using with multiprocessing:
+    if check_pickle:
+        pickle.dumps(function)
 
     def delayed_function(*args, **kwargs):
         return function, args, kwargs
@@ -519,7 +528,7 @@ class Parallel(Logger):
                         # Capture exception to add information on the local
                         # stack in addition to the distant stack
                         this_report = format_outer_frames(context=10,
-                                                        stack_start=1)
+                                                          stack_start=1)
                         report = """Multiprocessing exception:
     %s
     ---------------------------------------------------------------------------
diff --git a/sklearn/externals/joblib/pool.py b/sklearn/externals/joblib/pool.py
index 486ca69eaf..9a450e41b3 100644
--- a/sklearn/externals/joblib/pool.py
+++ b/sklearn/externals/joblib/pool.py
@@ -200,7 +200,9 @@ class ArrayMemmapReducer(object):
             # a is already backed by a memmap file, let's reuse it directly
             return _reduce_memmap_backed(a, m)
 
-        if self._max_nbytes is not None and a.nbytes > self._max_nbytes:
+        if (not a.dtype.hasobject
+                and self._max_nbytes is not None
+                and a.nbytes > self._max_nbytes):
             # check that the folder exists (lazily create the pool temp folder
             # if required)
             try:
-- 
GitLab