summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-08-24 18:32:06 (GMT)
committerBarry Warsaw <barry@python.org>2001-08-24 18:32:06 (GMT)
commitdadace004b4b94dcc4437bafc9c8407fbb1bed74 (patch)
treeb381d7e83a12d2a452c0c8c70da5acd26b8c522a /Include
parent16c018d2d24e7b3366edda53baf85fa3a4a21f1e (diff)
downloadcpython-dadace004b4b94dcc4437bafc9c8407fbb1bed74.zip
cpython-dadace004b4b94dcc4437bafc9c8407fbb1bed74.tar.gz
cpython-dadace004b4b94dcc4437bafc9c8407fbb1bed74.tar.bz2
PyString_FromFormat() and PyString_FromFormatV(): Largely ripped from
PyErr_Format() these new C API methods can be used instead of sprintf()'s into hardcoded char* buffers. This allows us to fix many situation where long package, module, or class names get truncated in reprs. PyString_FromFormat() is the varargs variety. PyString_FromFormatV() is the va_list variety Original PyErr_Format() code was modified to allow %p and %ld expansions. Many reprs were converted to this, checkins coming soo. Not changed: complex_repr(), float_repr(), float_print(), float_str(), int_repr(). There may be other candidates not yet converted. Closes patch #454743.
Diffstat (limited to 'Include')
-rw-r--r--Include/stringobject.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Include/stringobject.h b/Include/stringobject.h
index 96f371e..2d9ed2d 100644
--- a/Include/stringobject.h
+++ b/Include/stringobject.h
@@ -7,6 +7,8 @@
extern "C" {
#endif
+#include <stdarg.h>
+
/*
Type PyStringObject represents a character string. An extra zero byte is
reserved at the end to ensure it is zero-terminated, but a size is
@@ -53,6 +55,8 @@ extern DL_IMPORT(PyTypeObject) PyString_Type;
extern DL_IMPORT(PyObject *) PyString_FromStringAndSize(const char *, int);
extern DL_IMPORT(PyObject *) PyString_FromString(const char *);
+extern DL_IMPORT(PyObject *) PyString_FromFormatV(const char*, va_list);
+extern DL_IMPORT(PyObject *) PyString_FromFormat(const char*, ...);
extern DL_IMPORT(int) PyString_Size(PyObject *);
extern DL_IMPORT(char *) PyString_AsString(PyObject *);
extern DL_IMPORT(void) PyString_Concat(PyObject **, PyObject *);