diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2022-12-30 23:32:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-30 23:32:22 +0000 |
commit | 223ddc429497ddbb7257a75128194e25106a69e3 (patch) | |
tree | 965c978e9ce6a4c5cc68c2b3925fca66d045591e /Lib | |
parent | ef4c61c23cb2b3e8fe4238a21f275081ae0cfd3b (diff) | |
parent | f734c23e8c9b1316f7c242f25e1fda816770ed77 (diff) | |
download | swig-223ddc429497ddbb7257a75128194e25106a69e3.tar.gz |
Merge pull request #2460 from swig-fortran/remove-python-sprintf
[Python] Eliminate sprintf in generated code
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/python/pycontainer.swg | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg index d6fdff087..4910fecc0 100644 --- a/Lib/python/pycontainer.swg +++ b/Lib/python/pycontainer.swg @@ -386,7 +386,7 @@ namespace swig { size_t replacecount = (jj - ii + step - 1) / step; if (is.size() != replacecount) { char msg[1024]; - sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); + PyOS_snprintf(msg, sizeof(msg), "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); throw std::invalid_argument(msg); } typename Sequence::const_iterator isit = is.begin(); @@ -402,7 +402,7 @@ namespace swig { size_t replacecount = (ii - jj - step - 1) / -step; if (is.size() != replacecount) { char msg[1024]; - sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); + PyOS_snprintf(msg, sizeof(msg), "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); throw std::invalid_argument(msg); } typename Sequence::const_iterator isit = is.begin(); @@ -478,7 +478,7 @@ namespace swig return swig::as<T>(item); } catch (const std::invalid_argument& e) { char msg[1024]; - sprintf(msg, "in sequence element %d ", (int)_index); + PyOS_snprintf(msg, sizeof(msg), "in sequence element %d ", (int)_index); if (!PyErr_Occurred()) { ::%type_error(swig::type_name<T>()); } |