Skip to content

Commit 78c834e

Browse files
author
James William Pye
committed
Raise value error if given an infinite decimal.
Numeric does not support this.(?)
1 parent 719785e commit 78c834e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

postgresql/protocol/typio.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
get1 = itemgetter(1)
4343

4444
from itertools import chain, starmap, repeat, groupby, cycle, islice
45-
from ..python.itertools import interlace
4645

4746
from abc import ABCMeta, abstractmethod
4847

@@ -337,6 +336,8 @@ def numeric_pack(x,
337336
if not isinstance(x, Decimal):
338337
x = Decimal(x)
339338
x = x.as_tuple()
339+
if x.exponent == 'F':
340+
raise ValueError("numeric does not support infinite values")
340341

341342
# normalize trailing zeros (truncate em')
342343
# this is important in order to get the weight and padding correct

0 commit comments

Comments
 (0)