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

Created on 2018-06-02 21:10 by realead, last changed 2020-05-31 13:50 by serhiy.storchaka. This issue is now closed.

Messages (3)
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 committer) Date: 2019-11-16 00:13
IMHO there is no need/way for adding that clarification after this date (1.5 months left).
msg370458 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-05-31 13:50
Python 2.7 is no longer supported.
History
Date User Action Args
2020-05-31 13:50:39serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg370458

resolution: out of date
stage: resolved
2019-11-16 00:13:41BTaskayasetnosy: + benjamin.peterson, BTaskaya
messages: + msg356737
2018-06-02 21:10:56realeadcreate