[Python-checkins] bpo-27268: Fix incorrect error message on float('') (GH-2745)
Cheryl Sabella
webhook-mailer at python.org
Fri May 17 18:32:51 EDT 2019
https://github.com/python/cpython/commit/4fa7504ee3184cff064e23fe6799e717ed0f9357
commit: 4fa7504ee3184cff064e23fe6799e717ed0f9357
branch: master
author: Pedro Lacerda <pslacerda at users.noreply.github.com>
committer: Cheryl Sabella <cheryl.sabella at gmail.com>
date: 2019-05-17T18:32:44-04:00
summary:
bpo-27268: Fix incorrect error message on float('') (GH-2745)
files:
M Python/pystrtod.c
diff --git a/Python/pystrtod.c b/Python/pystrtod.c
index 02a3fb57805c..4aa99d546caf 100644
--- a/Python/pystrtod.c
+++ b/Python/pystrtod.c
@@ -353,15 +353,15 @@ PyOS_string_to_double(const char *s,
else if (!endptr && (fail_pos == s || *fail_pos != '\0'))
PyErr_Format(PyExc_ValueError,
"could not convert string to float: "
- "%.200s", s);
+ "'%.200s'", s);
else if (fail_pos == s)
PyErr_Format(PyExc_ValueError,
"could not convert string to float: "
- "%.200s", s);
+ "'%.200s'", s);
else if (errno == ERANGE && fabs(x) >= 1.0 && overflow_exception)
PyErr_Format(overflow_exception,
"value too large to convert to float: "
- "%.200s", s);
+ "'%.200s'", s);
else
result = x;
More information about the Python-checkins
mailing list