Skip to content

Commit e565230

Browse files
authored
ENH: use constant f32 eps, not np.finfo() during import
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.
1 parent 2cad4dd commit e565230

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/core/indexing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@ def _convert_key(self, key, is_setter=False):
18521852

18531853

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

18571857

18581858
def length_of_indexer(indexer, target=None):

0 commit comments

Comments
 (0)