We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
numexpr 2.3.1 error with pandas 0.13.1
I just installed numexpr 2.3.1 with pandas 0.13.1 and got the following error:

  File "C:\Python27\lib\site-packages\pandas\core\ops.py", line 496, in wrapper
    arr = na_op(lvalues, rvalues)
  File "C:\Python27\lib\site-packages\pandas\core\ops.py", line 443, in na_op
    raise_on_error=True, *_eval_kwargs)
  File "C:\Python27\lib\site-packages\pandas\computation\expressions.py", line 176, in evaluate
    *_eval_kwargs)
  File "C:\Python27\lib\site-packages\pandas\computation\expressions.py", line 104, in _evaluate_numexpr
    *_eval_kwargs)
  File "C:\Python27\lib\site-packages\numexpr\necompiler.py", line 738, in evaluate
    NumExpr(ex, signature, *_context)
  File "C:\Python27\lib\site-packages\numexpr\necompiler.py", line 554, in NumExpr
    precompile(ex, signature, context)
  File "C:\Python27\lib\site-packages\numexpr\necompiler.py", line 498, in precompile
    ast = typeCompileAst(ast)
  File "C:\Python27\lib\site-packages\numexpr\necompiler.py", line 163, in typeCompileAst
    % (ast.value + '_' + retsig+basesig))
NotImplementedError: couldn't find matching opcode for 'mul_bbb'


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pandas/computation/expressions.py`
Content:
```
1 """
2 Expressions
3 -----------
4 
5 Offer fast expression evaluation through numexpr
6 
7 """
8 
9 import numpy as np
10 from pandas.core.common import _values_from_object
11 from distutils.version import LooseVersion
12 
13 try:
14     import numexpr as ne
15     _NUMEXPR_INSTALLED = ne.__version__ >= LooseVersion('2.0')
16 except ImportError:  # pragma: no cover
17     _NUMEXPR_INSTALLED = False
18 
19 _TEST_MODE = None
20 _TEST_RESULT = None
21 _USE_NUMEXPR = _NUMEXPR_INSTALLED
22 _evaluate = None
23 _where = None
24 
25 # the set of dtypes that we will allow pass to numexpr
26 _ALLOWED_DTYPES = {
27     'evaluate': set(['int64', 'int32', 'float64', 'float32', 'bool']),
28     'where': set(['int64', 'float64', 'bool'])
29 }
30 
31 # the minimum prod shape that we will use numexpr
32 _MIN_ELEMENTS = 10000
33 
34 
35 def set_use_numexpr(v=True):
36     # set/unset to use numexpr
37     global _USE_NUMEXPR
38     if _NUMEXPR_INSTALLED:
39         _USE_NUMEXPR = v
40 
41     # choose what we are going to do
42     global _evaluate, _where
43     if not _USE_NUMEXPR:
44         _evaluate = _evaluate_standard
45         _where = _where_standard
46     else:
47         _evaluate = _evaluate_numexpr
48         _where = _where_numexpr
49 
50 
51 def set_numexpr_threads(n=None):
52     # if we are using numexpr, set the threads to n
53     # otherwise reset
54     if _NUMEXPR_INSTALLED and _USE_NUMEXPR:
55         if n is None:
56             n = ne.detect_number_of_cores()
57         ne.set_num_threads(n)
58 
59 
60 def _evaluate_standard(op, op_str, a, b, raise_on_error=True, **eval_kwargs):
61     """ standard evaluation """
62     if _TEST_MODE:
63         _store_test_result(False)
64     return op(a, b)
65 
66 
67 def _can_use_numexpr(op, op_str, a, b, dtype_check):
68     """ return a boolean if we WILL be using numexpr """
69     if op_str is not None:
70 
71         # required min elements (otherwise we are adding overhead)
72         if np.prod(a.shape) > _MIN_ELEMENTS:
73 
74             # check for dtype compatiblity
75             dtypes = set()
76             for o in [a, b]:
77                 if hasattr(o, 'get_dtype_counts'):
78                     s = o.get_dtype_counts()
79                     if len(s) > 1:
80                         return False
81                     dtypes |= set(s.index)
82                 elif isinstance(o, np.ndarray):
83                     dtypes |= set([o.dtype.name])
84 
85             # allowed are a superset
86             if not len(dtypes) or _ALLOWED_DTYPES[dtype_check] >= dtypes:
87                 return True
88 
89     return False
90 
91 
92 def _evaluate_numexpr(op, op_str, a, b, raise_on_error=False, truediv=True,
93                       **eval_kwargs):
94     result = None
95 
96     if _can_use_numexpr(op, op_str, a, b, 'evaluate'):
97         try:
98             a_value = getattr(a, "values", a)
99             b_value = getattr(b, "values", b)
100             result = ne.evaluate('a_value %s b_value' % op_str,
101                                  local_dict={'a_value': a_value,
102                                              'b_value': b_value},
103                                  casting='safe', truediv=truediv,
104                                  **eval_kwargs)
105         except ValueError as detail:
106             if 'unknown type object' in str(detail):
107                 pass
108         except Exception as detail:
109             if raise_on_error:
110                 raise
111 
112     if _TEST_MODE:
113         _store_test_result(result is not None)
114 
115     if result is None:
116         result = _evaluate_standard(op, op_str, a, b, raise_on_error)
117 
118     return result
119 
120 
121 def _where_standard(cond, a, b, raise_on_error=True):
122     return np.where(_values_from_object(cond), _values_from_object(a),
123                     _values_from_object(b))
124 
125 
126 def _where_numexpr(cond, a, b, raise_on_error=False):
127     result = None
128 
129     if _can_use_numexpr(None, 'where', a, b, 'where'):
130 
131         try:
132             cond_value = getattr(cond, 'values', cond)
133             a_value = getattr(a, 'values', a)
134             b_value = getattr(b, 'values', b)
135             result = ne.evaluate('where(cond_value, a_value, b_value)',
136                                  local_dict={'cond_value': cond_value,
137                                              'a_value': a_value,
138                                              'b_value': b_value},
139                                  casting='safe')
140         except ValueError as detail:
141             if 'unknown type object' in str(detail):
142                 pass
143         except Exception as detail:
144             if raise_on_error:
145                 raise TypeError(str(detail))
146 
147     if result is None:
148         result = _where_standard(cond, a, b, raise_on_error)
149 
150     return result
151 
152 
153 # turn myself on
154 set_use_numexpr(True)
155 
156 
157 def evaluate(op, op_str, a, b, raise_on_error=False, use_numexpr=True,
158              **eval_kwargs):
159     """ evaluate and return the expression of the op on a and b
160 
161         Parameters
162         ----------
163 
164         op :    the actual operand
165         op_str: the string version of the op
166         a :     left operand
167         b :     right operand
168         raise_on_error : pass the error to the higher level if indicated
169                          (default is False), otherwise evaluate the op with and
170                          return the results
171         use_numexpr : whether to try to use numexpr (default True)
172         """
173 
174     if use_numexpr:
175         return _evaluate(op, op_str, a, b, raise_on_error=raise_on_error,
176                          **eval_kwargs)
177     return _evaluate_standard(op, op_str, a, b, raise_on_error=raise_on_error)
178 
179 
180 def where(cond, a, b, raise_on_error=False, use_numexpr=True):
181     """ evaluate the where condition cond on a and b
182 
183         Parameters
184         ----------
185 
186         cond : a boolean array
187         a :    return if cond is True
188         b :    return if cond is False
189         raise_on_error : pass the error to the higher level if indicated
190                          (default is False), otherwise evaluate the op with and
191                          return the results
192         use_numexpr : whether to try to use numexpr (default True)
193         """
194 
195     if use_numexpr:
196         return _where(cond, a, b, raise_on_error=raise_on_error)
197     return _where_standard(cond, a, b, raise_on_error=raise_on_error)
198 
199 
200 def set_test_mode(v=True):
201     """
202     Keeps track of whether numexpr  was used.  Stores an additional ``True``
203     for every successful use of evaluate with numexpr since the last
204     ``get_test_result``
205     """
206     global _TEST_MODE, _TEST_RESULT
207     _TEST_MODE = v
208     _TEST_RESULT = []
209 
210 
211 def _store_test_result(used_numexpr):
212     global _TEST_RESULT
213     if used_numexpr:
214         _TEST_RESULT.append(used_numexpr)
215 
216 
217 def get_test_result():
218     """get test result and reset test_results"""
219     global _TEST_RESULT
220     res = _TEST_RESULT
221     _TEST_RESULT = []
222     return res
223
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pandas/computation/expressions.py b/pandas/computation/expressions.py
--- a/pandas/computation/expressions.py
+++ b/pandas/computation/expressions.py
@@ -154,6 +154,20 @@
 set_use_numexpr(True)
 
 
+def _has_bool_dtype(x):
+    try:
+        return x.dtype == bool
+    except AttributeError:
+        return 'bool' in x.blocks
+
+
+def _bool_arith_check(op_str, a, b, not_allowed=frozenset(('+', '*', '-', '/',
+                                                           '//', '**'))):
+    if op_str in not_allowed and _has_bool_dtype(a) and _has_bool_dtype(b):
+        raise NotImplementedError("operator %r not implemented for bool "
+                                  "dtypes" % op_str)
+
+
 def evaluate(op, op_str, a, b, raise_on_error=False, use_numexpr=True,
              **eval_kwargs):
     """ evaluate and return the expression of the op on a and b
@@ -170,7 +184,7 @@
                          return the results
         use_numexpr : whether to try to use numexpr (default True)
         """
-
+    _bool_arith_check(op_str, a, b)
     if use_numexpr:
         return _evaluate(op, op_str, a, b, raise_on_error=raise_on_error,
                          **eval_kwargs)

{"golden_diff": "diff --git a/pandas/computation/expressions.py b/pandas/computation/expressions.py\n--- a/pandas/computation/expressions.py\n+++ b/pandas/computation/expressions.py\n@@ -154,6 +154,20 @@\n set_use_numexpr(True)\n \n \n+def _has_bool_dtype(x):\n+    try:\n+        return x.dtype == bool\n+    except AttributeError:\n+        return 'bool' in x.blocks\n+\n+\n+def _bool_arith_check(op_str, a, b, not_allowed=frozenset(('+', '*', '-', '/',\n+                                                           '//', '**'))):\n+    if op_str in not_allowed and _has_bool_dtype(a) and _has_bool_dtype(b):\n+        raise NotImplementedError(\"operator %r not implemented for bool \"\n+                                  \"dtypes\" % op_str)\n+\n+\n def evaluate(op, op_str, a, b, raise_on_error=False, use_numexpr=True,\n              **eval_kwargs):\n     \"\"\" evaluate and return the expression of the op on a and b\n@@ -170,7 +184,7 @@\n                          return the results\n         use_numexpr : whether to try to use numexpr (default True)\n         \"\"\"\n-\n+    _bool_arith_check(op_str, a, b)\n     if use_numexpr:\n         return _evaluate(op, op_str, a, b, raise_on_error=raise_on_error,\n                          **eval_kwargs)\n", "issue": "numexpr 2.3.1 error with pandas 0.13.1\nI just installed numexpr 2.3.1 with pandas 0.13.1 and got the following error:\n\n  File \"C:\\Python27\\lib\\site-packages\\pandas\\core\\ops.py\", line 496, in wrapper\n    arr = na_op(lvalues, rvalues)\n  File \"C:\\Python27\\lib\\site-packages\\pandas\\core\\ops.py\", line 443, in na_op\n    raise_on_error=True, *_eval_kwargs)\n  File \"C:\\Python27\\lib\\site-packages\\pandas\\computation\\expressions.py\", line 176, in evaluate\n    *_eval_kwargs)\n  File \"C:\\Python27\\lib\\site-packages\\pandas\\computation\\expressions.py\", line 104, in _evaluate_numexpr\n    *_eval_kwargs)\n  File \"C:\\Python27\\lib\\site-packages\\numexpr\\necompiler.py\", line 738, in evaluate\n    NumExpr(ex, signature, *_context)\n  File \"C:\\Python27\\lib\\site-packages\\numexpr\\necompiler.py\", line 554, in NumExpr\n    precompile(ex, signature, context)\n  File \"C:\\Python27\\lib\\site-packages\\numexpr\\necompiler.py\", line 498, in precompile\n    ast = typeCompileAst(ast)\n  File \"C:\\Python27\\lib\\site-packages\\numexpr\\necompiler.py\", line 163, in typeCompileAst\n    % (ast.value + '_' + retsig+basesig))\nNotImplementedError: couldn't find matching opcode for 'mul_bbb'\n\n", "before_files": [{"content": "\"\"\"\nExpressions\n-----------\n\nOffer fast expression evaluation through numexpr\n\n\"\"\"\n\nimport numpy as np\nfrom pandas.core.common import _values_from_object\nfrom distutils.version import LooseVersion\n\ntry:\n    import numexpr as ne\n    _NUMEXPR_INSTALLED = ne.__version__ >= LooseVersion('2.0')\nexcept ImportError:  # pragma: no cover\n    _NUMEXPR_INSTALLED = False\n\n_TEST_MODE = None\n_TEST_RESULT = None\n_USE_NUMEXPR = _NUMEXPR_INSTALLED\n_evaluate = None\n_where = None\n\n# the set of dtypes that we will allow pass to numexpr\n_ALLOWED_DTYPES = {\n    'evaluate': set(['int64', 'int32', 'float64', 'float32', 'bool']),\n    'where': set(['int64', 'float64', 'bool'])\n}\n\n# the minimum prod shape that we will use numexpr\n_MIN_ELEMENTS = 10000\n\n\ndef set_use_numexpr(v=True):\n    # set/unset to use numexpr\n    global _USE_NUMEXPR\n    if _NUMEXPR_INSTALLED:\n        _USE_NUMEXPR = v\n\n    # choose what we are going to do\n    global _evaluate, _where\n    if not _USE_NUMEXPR:\n        _evaluate = _evaluate_standard\n        _where = _where_standard\n    else:\n        _evaluate = _evaluate_numexpr\n        _where = _where_numexpr\n\n\ndef set_numexpr_threads(n=None):\n    # if we are using numexpr, set the threads to n\n    # otherwise reset\n    if _NUMEXPR_INSTALLED and _USE_NUMEXPR:\n        if n is None:\n            n = ne.detect_number_of_cores()\n        ne.set_num_threads(n)\n\n\ndef _evaluate_standard(op, op_str, a, b, raise_on_error=True, **eval_kwargs):\n    \"\"\" standard evaluation \"\"\"\n    if _TEST_MODE:\n        _store_test_result(False)\n    return op(a, b)\n\n\ndef _can_use_numexpr(op, op_str, a, b, dtype_check):\n    \"\"\" return a boolean if we WILL be using numexpr \"\"\"\n    if op_str is not None:\n\n        # required min elements (otherwise we are adding overhead)\n        if np.prod(a.shape) > _MIN_ELEMENTS:\n\n            # check for dtype compatiblity\n            dtypes = set()\n            for o in [a, b]:\n                if hasattr(o, 'get_dtype_counts'):\n                    s = o.get_dtype_counts()\n                    if len(s) > 1:\n                        return False\n                    dtypes |= set(s.index)\n                elif isinstance(o, np.ndarray):\n                    dtypes |= set([o.dtype.name])\n\n            # allowed are a superset\n            if not len(dtypes) or _ALLOWED_DTYPES[dtype_check] >= dtypes:\n                return True\n\n    return False\n\n\ndef _evaluate_numexpr(op, op_str, a, b, raise_on_error=False, truediv=True,\n                      **eval_kwargs):\n    result = None\n\n    if _can_use_numexpr(op, op_str, a, b, 'evaluate'):\n        try:\n            a_value = getattr(a, \"values\", a)\n            b_value = getattr(b, \"values\", b)\n            result = ne.evaluate('a_value %s b_value' % op_str,\n                                 local_dict={'a_value': a_value,\n                                             'b_value': b_value},\n                                 casting='safe', truediv=truediv,\n                                 **eval_kwargs)\n        except ValueError as detail:\n            if 'unknown type object' in str(detail):\n                pass\n        except Exception as detail:\n            if raise_on_error:\n                raise\n\n    if _TEST_MODE:\n        _store_test_result(result is not None)\n\n    if result is None:\n        result = _evaluate_standard(op, op_str, a, b, raise_on_error)\n\n    return result\n\n\ndef _where_standard(cond, a, b, raise_on_error=True):\n    return np.where(_values_from_object(cond), _values_from_object(a),\n                    _values_from_object(b))\n\n\ndef _where_numexpr(cond, a, b, raise_on_error=False):\n    result = None\n\n    if _can_use_numexpr(None, 'where', a, b, 'where'):\n\n        try:\n            cond_value = getattr(cond, 'values', cond)\n            a_value = getattr(a, 'values', a)\n            b_value = getattr(b, 'values', b)\n            result = ne.evaluate('where(cond_value, a_value, b_value)',\n                                 local_dict={'cond_value': cond_value,\n                                             'a_value': a_value,\n                                             'b_value': b_value},\n                                 casting='safe')\n        except ValueError as detail:\n            if 'unknown type object' in str(detail):\n                pass\n        except Exception as detail:\n            if raise_on_error:\n                raise TypeError(str(detail))\n\n    if result is None:\n        result = _where_standard(cond, a, b, raise_on_error)\n\n    return result\n\n\n# turn myself on\nset_use_numexpr(True)\n\n\ndef evaluate(op, op_str, a, b, raise_on_error=False, use_numexpr=True,\n             **eval_kwargs):\n    \"\"\" evaluate and return the expression of the op on a and b\n\n        Parameters\n        ----------\n\n        op :    the actual operand\n        op_str: the string version of the op\n        a :     left operand\n        b :     right operand\n        raise_on_error : pass the error to the higher level if indicated\n                         (default is False), otherwise evaluate the op with and\n                         return the results\n        use_numexpr : whether to try to use numexpr (default True)\n        \"\"\"\n\n    if use_numexpr:\n        return _evaluate(op, op_str, a, b, raise_on_error=raise_on_error,\n                         **eval_kwargs)\n    return _evaluate_standard(op, op_str, a, b, raise_on_error=raise_on_error)\n\n\ndef where(cond, a, b, raise_on_error=False, use_numexpr=True):\n    \"\"\" evaluate the where condition cond on a and b\n\n        Parameters\n        ----------\n\n        cond : a boolean array\n        a :    return if cond is True\n        b :    return if cond is False\n        raise_on_error : pass the error to the higher level if indicated\n                         (default is False), otherwise evaluate the op with and\n                         return the results\n        use_numexpr : whether to try to use numexpr (default True)\n        \"\"\"\n\n    if use_numexpr:\n        return _where(cond, a, b, raise_on_error=raise_on_error)\n    return _where_standard(cond, a, b, raise_on_error=raise_on_error)\n\n\ndef set_test_mode(v=True):\n    \"\"\"\n    Keeps track of whether numexpr  was used.  Stores an additional ``True``\n    for every successful use of evaluate with numexpr since the last\n    ``get_test_result``\n    \"\"\"\n    global _TEST_MODE, _TEST_RESULT\n    _TEST_MODE = v\n    _TEST_RESULT = []\n\n\ndef _store_test_result(used_numexpr):\n    global _TEST_RESULT\n    if used_numexpr:\n        _TEST_RESULT.append(used_numexpr)\n\n\ndef get_test_result():\n    \"\"\"get test result and reset test_results\"\"\"\n    global _TEST_RESULT\n    res = _TEST_RESULT\n    _TEST_RESULT = []\n    return res\n", "path": "pandas/computation/expressions.py"}], "after_files": [{"content": "\"\"\"\nExpressions\n-----------\n\nOffer fast expression evaluation through numexpr\n\n\"\"\"\n\nimport numpy as np\nfrom pandas.core.common import _values_from_object\nfrom distutils.version import LooseVersion\n\ntry:\n    import numexpr as ne\n    _NUMEXPR_INSTALLED = ne.__version__ >= LooseVersion('2.0')\nexcept ImportError:  # pragma: no cover\n    _NUMEXPR_INSTALLED = False\n\n_TEST_MODE = None\n_TEST_RESULT = None\n_USE_NUMEXPR = _NUMEXPR_INSTALLED\n_evaluate = None\n_where = None\n\n# the set of dtypes that we will allow pass to numexpr\n_ALLOWED_DTYPES = {\n    'evaluate': set(['int64', 'int32', 'float64', 'float32', 'bool']),\n    'where': set(['int64', 'float64', 'bool'])\n}\n\n# the minimum prod shape that we will use numexpr\n_MIN_ELEMENTS = 10000\n\n\ndef set_use_numexpr(v=True):\n    # set/unset to use numexpr\n    global _USE_NUMEXPR\n    if _NUMEXPR_INSTALLED:\n        _USE_NUMEXPR = v\n\n    # choose what we are going to do\n    global _evaluate, _where\n    if not _USE_NUMEXPR:\n        _evaluate = _evaluate_standard\n        _where = _where_standard\n    else:\n        _evaluate = _evaluate_numexpr\n        _where = _where_numexpr\n\n\ndef set_numexpr_threads(n=None):\n    # if we are using numexpr, set the threads to n\n    # otherwise reset\n    if _NUMEXPR_INSTALLED and _USE_NUMEXPR:\n        if n is None:\n            n = ne.detect_number_of_cores()\n        ne.set_num_threads(n)\n\n\ndef _evaluate_standard(op, op_str, a, b, raise_on_error=True, **eval_kwargs):\n    \"\"\" standard evaluation \"\"\"\n    if _TEST_MODE:\n        _store_test_result(False)\n    return op(a, b)\n\n\ndef _can_use_numexpr(op, op_str, a, b, dtype_check):\n    \"\"\" return a boolean if we WILL be using numexpr \"\"\"\n    if op_str is not None:\n\n        # required min elements (otherwise we are adding overhead)\n        if np.prod(a.shape) > _MIN_ELEMENTS:\n\n            # check for dtype compatiblity\n            dtypes = set()\n            for o in [a, b]:\n                if hasattr(o, 'get_dtype_counts'):\n                    s = o.get_dtype_counts()\n                    if len(s) > 1:\n                        return False\n                    dtypes |= set(s.index)\n                elif isinstance(o, np.ndarray):\n                    dtypes |= set([o.dtype.name])\n\n            # allowed are a superset\n            if not len(dtypes) or _ALLOWED_DTYPES[dtype_check] >= dtypes:\n                return True\n\n    return False\n\n\ndef _evaluate_numexpr(op, op_str, a, b, raise_on_error=False, truediv=True,\n                      **eval_kwargs):\n    result = None\n\n    if _can_use_numexpr(op, op_str, a, b, 'evaluate'):\n        try:\n            a_value = getattr(a, \"values\", a)\n            b_value = getattr(b, \"values\", b)\n            result = ne.evaluate('a_value %s b_value' % op_str,\n                                 local_dict={'a_value': a_value,\n                                             'b_value': b_value},\n                                 casting='safe', truediv=truediv,\n                                 **eval_kwargs)\n        except ValueError as detail:\n            if 'unknown type object' in str(detail):\n                pass\n        except Exception as detail:\n            if raise_on_error:\n                raise\n\n    if _TEST_MODE:\n        _store_test_result(result is not None)\n\n    if result is None:\n        result = _evaluate_standard(op, op_str, a, b, raise_on_error)\n\n    return result\n\n\ndef _where_standard(cond, a, b, raise_on_error=True):\n    return np.where(_values_from_object(cond), _values_from_object(a),\n                    _values_from_object(b))\n\n\ndef _where_numexpr(cond, a, b, raise_on_error=False):\n    result = None\n\n    if _can_use_numexpr(None, 'where', a, b, 'where'):\n\n        try:\n            cond_value = getattr(cond, 'values', cond)\n            a_value = getattr(a, 'values', a)\n            b_value = getattr(b, 'values', b)\n            result = ne.evaluate('where(cond_value, a_value, b_value)',\n                                 local_dict={'cond_value': cond_value,\n                                             'a_value': a_value,\n                                             'b_value': b_value},\n                                 casting='safe')\n        except ValueError as detail:\n            if 'unknown type object' in str(detail):\n                pass\n        except Exception as detail:\n            if raise_on_error:\n                raise TypeError(str(detail))\n\n    if result is None:\n        result = _where_standard(cond, a, b, raise_on_error)\n\n    return result\n\n\n# turn myself on\nset_use_numexpr(True)\n\n\ndef _has_bool_dtype(x):\n    try:\n        return x.dtype == bool\n    except AttributeError:\n        return 'bool' in x.blocks\n\n\ndef _bool_arith_check(op_str, a, b, not_allowed=frozenset(('+', '*', '-', '/',\n                                                           '//', '**'))):\n    if op_str in not_allowed and _has_bool_dtype(a) and _has_bool_dtype(b):\n        raise NotImplementedError(\"operator %r not implemented for bool \"\n                                  \"dtypes\" % op_str)\n\n\ndef evaluate(op, op_str, a, b, raise_on_error=False, use_numexpr=True,\n             **eval_kwargs):\n    \"\"\" evaluate and return the expression of the op on a and b\n\n        Parameters\n        ----------\n\n        op :    the actual operand\n        op_str: the string version of the op\n        a :     left operand\n        b :     right operand\n        raise_on_error : pass the error to the higher level if indicated\n                         (default is False), otherwise evaluate the op with and\n                         return the results\n        use_numexpr : whether to try to use numexpr (default True)\n        \"\"\"\n    _bool_arith_check(op_str, a, b)\n    if use_numexpr:\n        return _evaluate(op, op_str, a, b, raise_on_error=raise_on_error,\n                         **eval_kwargs)\n    return _evaluate_standard(op, op_str, a, b, raise_on_error=raise_on_error)\n\n\ndef where(cond, a, b, raise_on_error=False, use_numexpr=True):\n    \"\"\" evaluate the where condition cond on a and b\n\n        Parameters\n        ----------\n\n        cond : a boolean array\n        a :    return if cond is True\n        b :    return if cond is False\n        raise_on_error : pass the error to the higher level if indicated\n                         (default is False), otherwise evaluate the op with and\n                         return the results\n        use_numexpr : whether to try to use numexpr (default True)\n        \"\"\"\n\n    if use_numexpr:\n        return _where(cond, a, b, raise_on_error=raise_on_error)\n    return _where_standard(cond, a, b, raise_on_error=raise_on_error)\n\n\ndef set_test_mode(v=True):\n    \"\"\"\n    Keeps track of whether numexpr  was used.  Stores an additional ``True``\n    for every successful use of evaluate with numexpr since the last\n    ``get_test_result``\n    \"\"\"\n    global _TEST_MODE, _TEST_RESULT\n    _TEST_MODE = v\n    _TEST_RESULT = []\n\n\ndef _store_test_result(used_numexpr):\n    global _TEST_RESULT\n    if used_numexpr:\n        _TEST_RESULT.append(used_numexpr)\n\n\ndef get_test_result():\n    \"\"\"get test result and reset test_results\"\"\"\n    global _TEST_RESULT\n    res = _TEST_RESULT\n    _TEST_RESULT = []\n    return res\n", "path": "pandas/computation/expressions.py"}]}