| [ Web Proxy ] |
| Viewing: https://docs.python.org/2.3/api/stringObjects.html | [Back] [Original] |
These functions raise TypeError when expecting a string parameter and are called with a non-string parameter.
types.TypeType in the Python
layer.
.
| int PyString_Check( | PyObject *o) |
| int PyString_CheckExact( | PyObject *o) |
| PyObject* PyString_FromString( | const char *v) |
| PyObject* PyString_FromStringAndSize( | const char *v, int len) |
| PyObject* PyString_FromFormat( | const char *format, ...) |
| Format Characters | Type | Comment |
|---|---|---|
| %% | n/a | The literal % character. |
| %c | int | A single character, represented as an C int. |
| %d | int | Exactly equivalent to printf("%d"). |
| %ld | long | Exactly equivalent to printf("%ld"). |
| %i | int | Exactly equivalent to printf("%i"). |
| %x | int | Exactly equivalent to printf("%x"). |
| %s | char* | A null-terminated C character array. |
| %p | void* | The hex representation of a C pointer.
Mostly equivalent to printf("%p") except that it is
guaranteed to start with the literal 0x regardless of
what the platform's printf yields. |
| PyObject* PyString_FromFormatV( | const char *format, va_list vargs) |
| int PyString_Size( | PyObject *string) |
| int PyString_GET_SIZE( | PyObject *string) |
| char* PyString_AsString( | PyObject *string) |
PyString_FromStringAndSize(NULL, size).
It must not be deallocated. If string is a Unicode object,
this function computes the default encoding of string and
operates on that. If string is not a string object at all,
PyString_AsString() returns NULL and raises
TypeError.
| char* PyString_AS_STRING( | PyObject *string) |
| int PyString_AsStringAndSize( | PyObject *obj, char **buffer, int *length) |
The function accepts both string and Unicode objects as input. For
Unicode objects it returns the default encoded version of the
object. If length is NULL, the resulting buffer may not
contain NUL characters; if it does, the function returns -1
and a TypeError is raised.
The buffer refers to an internal string buffer of obj, not a
copy. The data must not be modified in any way, unless the string
was just created using PyString_FromStringAndSize(NULL,
size). It must not be deallocated. If string is a
Unicode object, this function computes the default encoding of
string and operates on that. If string is not a string
object at all, PyString_AsString() returns NULL and
raises TypeError.
| void PyString_Concat( | PyObject **string, PyObject *newpart) |
| void PyString_ConcatAndDel( | PyObject **string, PyObject *newpart) |
| int _PyString_Resize( | PyObject **string, int newsize) |
0 is returned; the address in
*string may differ from its input value. If the
reallocation fails, the original string object at *string is
deallocated, *string is set to NULL, a memory exception is set,
and -1 is returned.
| PyObject* PyString_Format( | PyObject *format, PyObject *args) |
format % args. The args
argument must be a tuple.
| void PyString_InternInPlace( | PyObject **string) |
| PyObject* PyString_InternFromString( | const char *v) |
| PyObject* PyString_Decode( | const char *s, int size, const char *encoding, const char *errors) |
| PyObject* PyString_AsDecodedObject( | PyObject *str, const char *encoding, const char *errors) |
| PyObject* PyString_Encode( | const char *s, int size, const char *encoding, const char *errors) |
| PyObject* PyString_AsEncodedObject( | PyObject *str, const char *encoding, const char *errors) |
See About this document... for information on suggesting changes.
| Web Proxy Viewer | New URL | Original Page |