Open
Description
Describe the bug
While PyMySQL handles float("nan"|"inf"|"-inf") correctly and raises an exception before sending the command to the server, it doesn't handle corresponding decimal.Decimal types (NaN, sNaN, Infinity, -Infinity).
To Reproduce
Code:
import pymysql
con = pymysql.connect(...)
cursor = con.cursor()
a= float("nan")
b= decimal.Decimal("nan")
try:
cursor.execute("select %s", (a,))
except Exception as e:
print(e)
pass
try:
cursor.execute("select %s", (b,))
except Exception as e:
print(e)
pass
Expected behavior
nan can not be used with MySQL
nan can not be used with MySQL
Preferrable in both cases the exception should be a NotSupportedError with the following message:
Parameter 'nan' for float or decimal types is not supported
Environment
- PyMySQL version: 1.4.5
Metadata
Metadata
Assignees
Labels
No labels