These functions raise TypeError when expecting a string parameter and are called with a non-string parameter.
types.TypeType
in the Python
layer.
.
PyObject *o) |
PyObject *o) |
const char *v) |
const char *v, int len) |
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. |
const char *format, va_list vargs) |
PyObject *string) |
PyObject *string) |
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.
PyObject *string) |
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.
PyObject **string, PyObject *newpart) |
PyObject **string, PyObject *newpart) |
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 *format, PyObject *args) |
format % args
. The args
argument must be a tuple.
PyObject **string) |
const char *v) |
const char *s, int size, const char *encoding, const char *errors) |
PyObject *str, const char *encoding, const char *errors) |
const char *s, int size, const char *encoding, const char *errors) |
PyObject *str, const char *encoding, const char *errors) |
Vedete Circa questo documento... per informazioni su modifiche e suggerimenti.