Skip to content

Commit 454af45

Browse files
Don't accept non-finite float values (+/- inf and NaN) (#16)
1 parent bcfe5b2 commit 454af45

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bulk_insert.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ def prop_to_binary(prop_val, type):
298298
if type == None or type == Type.NUMERIC:
299299
try:
300300
numeric_prop = float(prop_val)
301-
return struct.pack(format_str + "d", Type.NUMERIC, numeric_prop)
301+
if not math.isnan(numeric_prop) and not math.isinf(numeric_prop): # Don't accept non-finite values.
302+
return struct.pack(format_str + "d", Type.NUMERIC, numeric_prop)
302303
except:
303304
pass
304305

0 commit comments

Comments
 (0)