diff options
author | Pedro Lacerda <pslacerda@users.noreply.github.com> | 2019-05-17 22:32:44 (GMT) |
---|---|---|
committer | Cheryl Sabella <cheryl.sabella@gmail.com> | 2019-05-17 22:32:44 (GMT) |
commit | 4fa7504ee3184cff064e23fe6799e717ed0f9357 (patch) | |
tree | 2afe48d44613a3a6aa6283176a5b84bcf8bba875 | |
parent | 871ff77c1cd334a141d52b0d003c080a1928731e (diff) | |
download | cpython-4fa7504ee3184cff064e23fe6799e717ed0f9357.zip cpython-4fa7504ee3184cff064e23fe6799e717ed0f9357.tar.gz cpython-4fa7504ee3184cff064e23fe6799e717ed0f9357.tar.bz2 |
bpo-27268: Fix incorrect error message on float('') (GH-2745)
-rw-r--r-- | Python/pystrtod.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/pystrtod.c b/Python/pystrtod.c index 02a3fb5..4aa99d5 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; |