Jonathan Underwood added the comment:
Actually the commentary at the top of bytesobject.c for
PyBytes_FromStringAndSize says:
"... If `str' is NULL then PyBytes_FromStringAndSize() will allocate `size+1'
bytes (setting the last byte to the null terminating character)... "
Jonathan Underwood added the comment:
Py_SIZE is actually precisely specified and documented[1] as it stands; I don't
think a change there is needed. The usage I outlined is in line with that
documentation, and many other uses of that macro in the cpython sources.
The documentation i
Change by Jonathan Underwood :
--
keywords: +patch
pull_requests: +4911
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue32431>
___
_
Jonathan Underwood added the comment:
https://github.com/python/cpython/pull/5021
--
___
Python tracker
<https://bugs.python.org/issue32431>
___
___
Python-bug
New submission from Jonathan Underwood :
With the current logic in Objects/bytesobject.c in the function
bytes_compare_eq it can be the case that zero length bytes object object
created in an extension module like this:
val = PyBytes_FromStringAndSize (NULL, 20);
Py_SIZE(val) = 0;
won