Skip to content

Commit 9219f8b

Browse files
author
A. Jesse Jiryu Davis
committed
float('inf') isn't available everywhere, use 1e9 instead
1 parent 043f027 commit 9219f8b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pymongo/common.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ def validate_positive_float(option, value):
9494
except (ValueError, TypeError):
9595
raise err
9696

97-
# float('inf') doesn't work in 2.4 or 2.5 on Windows, but this does
98-
if not 0 < value < 1e100000:
97+
# float('inf') doesn't work in 2.4 or 2.5 on Windows, so just cap floats at
98+
# one billion - this is a reasonable approximation for infinity
99+
if not 0 < value < 1e9:
99100
raise err
100101

101102
return value

0 commit comments

Comments
 (0)