Skip to content

Commit

Permalink
ENH: use constant f32 eps, not np.finfo() during import
Browse files Browse the repository at this point in the history
NumPy docs for `np.finfo()` say not to call it during import (at module scope).
It's a relatively expensive call, and it modifies the GIL state.
Now we just hard-code it, because it is always the value anyway.
This avoids touching the GIL at import, which helps avoid deadlocks in practice.

Closes pandas-dev#14641.
  • Loading branch information
jzwinck committed Mar 15, 2017
1 parent 2cad4dd commit e565230
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pandas/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ def _convert_key(self, key, is_setter=False):


# 32-bit floating point machine epsilon
_eps = np.finfo('f4').eps
_eps = 1.1920929e-07


def length_of_indexer(indexer, target=None):
Expand Down

0 comments on commit e565230

Please sign in to comment.