06.03.18 12:34, Xiang Zhang пише:
author: Siddhesh Poyarekar <siddhesh.poyare...@gmail.com>
committer: Xiang Zhang <angwe...@126.com>
Fix strncpy warning with gcc 8 (#5840)
The length in strncpy is one char too short and as a result it leads
to a build warning with gcc 8. Comment out the strncpy since the
interpreter aborts immediately after anyway.
diff --git a/Python/pystrtod.c b/Python/pystrtod.c
index 9bf936386210..601f7c691edf 100644
@@ -1060,8 +1060,8 @@ format_float_short(double d, char format_code,
/* shouldn't get here: Gay's code should always return
something starting with a digit, an 'I', or 'N' */
- strncpy(p, "ERR", 3);
- /* p += 3; */
+ /* strncpy(p, "ERR", 3);
+ p += 3; */
I think this code was added for purpose. In the case of programming
error we could get meaningful value in post-mortal debugging. But after
replacing assert(0) with Py_UNREACHABLE this perhaps lost a sense.
If this code is no longer needed it is better to remove it than keeping
an obscure comment.
What are your thoughts @warsaw and @ericvsmith?
Py_UNREACHABLE was added in issue31338 by Barry. The original code was
added in issue1580 by Eric Smith (maybe it was copied from other place).
Python-Dev mailing list