These functions raise TypeError when expecting a string parameter and are called with a non-string parameter.
types.TypeType
in the Python
layer.
.
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. |
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.
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.
format % args
. The args
argument must be a tuple.
See About this document... for information on suggesting changes.