[New-bugs-announce] [issue14995] PyLong_FromString documentation should state that the string must be null-terminated
Ryan Kelly
report at bugs.python.org
Mon Jun 4 02:32:53 CEST 2012
New submission from Ryan Kelly <ryan at rfk.id.au>:
PyLong_FromString will raise a ValueError if the given string doesn't contain a null byte after the digits. For example, this will result in a ValueError
char *pend;
PyLong_FromString("1234 extra", &pend, 10)
While this will successfully read the number and set the pointer to the extra data:
char *pend;
PyLong_FromString("1234\0extra", &pend, 10)
The requirement for a null-terminated string of digits is not clear from the docs. Suggested re-wording attached.
----------
assignee: docs at python
components: Documentation
files: PyLong_FromString-doc.patch
keywords: patch
messages: 162242
nosy: docs at python, rfk
priority: normal
severity: normal
status: open
title: PyLong_FromString documentation should state that the string must be null-terminated
Added file: http://bugs.python.org/file25812/PyLong_FromString-doc.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14995>
_______________________________________
More information about the New-bugs-announce
mailing list