Skip to content

Commit

Permalink
Fix decimal literal. (#828)
Browse files Browse the repository at this point in the history
Fixes #818.
  • Loading branch information
methane committed Nov 26, 2019
1 parent 2330bf7 commit 0f4d45e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pymysql/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ def escape_date(obj, mapping=None):
def escape_struct_time(obj, mapping=None):
return escape_datetime(datetime.datetime(*obj[:6]))


def Decimal2Literal(o, d):
return format(o, "f")


def _convert_second_fraction(s):
if not s:
return 0
Expand Down Expand Up @@ -337,7 +342,7 @@ def through(x):
datetime.timedelta: escape_timedelta,
datetime.time: escape_time,
time.struct_time: escape_struct_time,
Decimal: escape_object,
Decimal: Decimal2Literal,
}

if not PY2 or JYTHON or IRONPYTHON:
Expand Down

0 comments on commit 0f4d45e

Please sign in to comment.