From 87d3b9db4ade1aa100ee6f065082cb7e85b8992f Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 25 Mar 2020 19:27:36 +0100 Subject: bpo-39882: Add _Py_FatalErrorFormat() function (GH-19157) --- Python/mysnprintf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Python/mysnprintf.c') diff --git a/Python/mysnprintf.c b/Python/mysnprintf.c index a08e249b42..945a81abb0 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; -- cgit v1.2.1