[issue21071] struct.Struct.format is bytes, but should be str
Martin Panter added the comment:
Here is a patch that changes over to a str() type.
Is it safe to assume PyUnicode_AsUTF8() is null-terminated (like PyBytes_AS_STRING() is)? My documentation doesn’t say.
----------
Added file: http://bugs.python.org/file37488/format-str.patch
_______________________________________
Python tracker
STINNER Victor added the comment:
Is it safe to assume PyUnicode_AsUTF8() is null-terminated?
Yes, Python ensures that the string is null terminated.
(like PyBytes_AS_STRING() is)
Yes, PyBytes_AS_STRING() also ends with a null byte.
By the way, Unicode strings internally ends with a null character.
----------
_______________________________________
Python tracker
participants (2)
-
Martin Panter
-
STINNER Victor