Skip to content

Commit

Permalink
float('inf') isn't available everywhere, use 1e9 instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ajdavis committed Nov 27, 2012
1 parent 043f027 commit 9219f8b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pymongo/common.py
Expand Up @@ -94,8 +94,9 @@ def validate_positive_float(option, value):
except (ValueError, TypeError):
raise err

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

return value
Expand Down

0 comments on commit 9219f8b

Please sign in to comment.