We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 59ee210 commit cc33b50Copy full SHA for cc33b50
src/mysql_capi.c
@@ -2562,15 +2562,18 @@ MySQL_fetch_row(MySQL *self)
2562
else if (field_type == MYSQL_TYPE_FLOAT ||
2563
field_type == MYSQL_TYPE_DOUBLE)
2564
{
2565
-#ifdef PY3
2566
- value= PyFloat_FromString(PyStringFromString(row[i]));
2567
-#else
2568
- value= PyFloat_FromString(PyStringFromString(row[i]), NULL);
2569
-#endif
2570
- if (!value)
+ char *end;
+ double val= PyOS_string_to_double(row[i], &end, NULL);
+
+ if (*end == '\0')
+ {
+ value= PyFloat_FromDouble(val);
2571
+ }
2572
+ else
2573
2574
value= Py_None;
2575
}
2576
2577
PyTuple_SET_ITEM(result_row, i, value);
2578
2579
else if (field_type == MYSQL_TYPE_BIT)
0 commit comments