diff options
author | Victor Stinner <vstinner@python.org> | 2020-03-25 18:27:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-25 18:27:36 (GMT) |
commit | 87d3b9db4ade1aa100ee6f065082cb7e85b8992f (patch) | |
tree | 85d17fff35bc28beb4a7c6e3a82276f2fa3760d5 /Python/mysnprintf.c | |
parent | ace018ca47c03ca699603341b12781b5329d2eaa (diff) | |
download | cpython-87d3b9db4ade1aa100ee6f065082cb7e85b8992f.zip cpython-87d3b9db4ade1aa100ee6f065082cb7e85b8992f.tar.gz cpython-87d3b9db4ade1aa100ee6f065082cb7e85b8992f.tar.bz2 |
bpo-39882: Add _Py_FatalErrorFormat() function (GH-19157)
Diffstat (limited to 'Python/mysnprintf.c')
-rw-r--r-- | Python/mysnprintf.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Python/mysnprintf.c b/Python/mysnprintf.c index a08e249..945a81a 100644 --- a/Python/mysnprintf.c +++ b/Python/mysnprintf.c @@ -81,12 +81,12 @@ PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) } len = vsprintf(buffer, format, va); - if (len < 0) + if (len < 0) { /* ignore the error */; - - else if ((size_t)len >= size + _PyOS_vsnprintf_EXTRA_SPACE) - Py_FatalError("Buffer overflow in PyOS_snprintf/PyOS_vsnprintf"); - + } + else if ((size_t)len >= size + _PyOS_vsnprintf_EXTRA_SPACE) { + _Py_FatalErrorFunc(__func__, "Buffer overflow"); + } else { const size_t to_copy = (size_t)len < size ? (size_t)len : size - 1; |