classification
Title: PyByteArray_AsString C-API description lacks the assurance, that the trailing null-byte is appended.
Type: Stage:
Components: Documentation Versions: Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: BTaskaya, benjamin.peterson, docs@python, realead
Priority: normal Keywords:

Created on 2018-06-02 21:10 by realead, last changed 2019-11-16 00:13 by BTaskaya.

Messages (2)
msg318515 - (view) Author: (realead) Date: 2018-06-02 21:10
The C-API for Python2.7 https://docs.python.org/2/c-api/bytearray.html#c.PyByteArray_AsString

lacks the sentence: "The returned array always has an extra null byte appended." which clarifies, that the returned C-string is null-terminated.

This sentence is a part of Python3-documentation: https://docs.python.org/3/c-api/bytearray.html#c.PyByteArray_AsString

I might be very wrong, but so far I understand the code this is the case for both versions, Python3 and Python2.

Probably parts of this change https://github.com/python/cpython/commit/0a560a11af0ccc816d1172180f44e5afb34ba600 could be integrated in Python2.7
msg356737 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python triager) Date: 2019-11-16 00:13
IMHO there is no need/way for adding that clarification after this date (1.5 months left).
History
Date User Action Args
2019-11-16 00:13:41BTaskayasetnosy: + benjamin.peterson, BTaskaya
messages: + msg356737
2018-06-02 21:10:56realeadcreate