Mercurial > cpython-lru_cache-weakref
diff Include/stringobject.h @ 19475:bc63afc701ef legacy-trunk
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.
| author | Barry Warsaw <barry@python.org> |
|---|---|
| date | Fri, 24 Aug 2001 18:32:06 +0000 |
| parents | 9d533ae574d2 |
| children | 844553473fa4 |
line wrap: on
line diff
--- a/Include/stringobject.h Fri Aug 24 17:13:54 2001 +0000 +++ b/Include/stringobject.h Fri Aug 24 18:32:06 2001 +0000 @@ -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(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 *);
