We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2f2df7a commit 1f61818Copy full SHA for 1f61818
1 file changed
postgresql/types/io/stdlib_decimal.py
@@ -130,13 +130,17 @@ def numeric_pack(x,
130
131
def numeric_convert_digits(d, str = str, int = int):
132
i = iter(d)
133
- for x in str(next(i)):
134
- # no leading zeros
135
- yield int(x)
136
- # leading digit should not include zeros
137
- for y in i:
138
- for x in str(y).rjust(4, '0'):
+ try:
+ for x in str(next(i)):
+ # no leading zeros
139
yield int(x)
+ # leading digit should not include zeros
+ for y in i:
+ for x in str(y).rjust(4, '0'):
140
+ yield int(x)
141
+ except StopIteration:
142
+ # Python 3.5+ does not like generators raising StopIteration
143
+ return
144
145
numeric_signs = {
146
numeric_negative : 1,
0 commit comments