Skip to content

Commit 0f4d45e

Browse files
authored
Fix decimal literal. (PyMySQL#828)
Fixes PyMySQL#818.
1 parent 2330bf7 commit 0f4d45e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pymysql/converters.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ def escape_date(obj, mapping=None):
159159
def escape_struct_time(obj, mapping=None):
160160
return escape_datetime(datetime.datetime(*obj[:6]))
161161

162+
163+
def Decimal2Literal(o, d):
164+
return format(o, "f")
165+
166+
162167
def _convert_second_fraction(s):
163168
if not s:
164169
return 0
@@ -337,7 +342,7 @@ def through(x):
337342
datetime.timedelta: escape_timedelta,
338343
datetime.time: escape_time,
339344
time.struct_time: escape_struct_time,
340-
Decimal: escape_object,
345+
Decimal: Decimal2Literal,
341346
}
342347

343348
if not PY2 or JYTHON or IRONPYTHON:

0 commit comments

Comments
 (0)