[docs] Update documented signatures of tp_get/setattr (issue 28771)

storchaka+cpython at gmail.com storchaka+cpython at gmail.com
Thu Nov 24 00:54:06 EST 2016


http://bugs.python.org/review/28771/diff/19257/Doc/c-api/typeobj.rst
File Doc/c-api/typeobj.rst (right):

http://bugs.python.org/review/28771/diff/19257/Doc/c-api/typeobj.rst#newcode204
Doc/c-api/typeobj.rst:204: PyObject * tp_getattr(PyObject *o, char
*attr_name);
On 2016/11/24 00:59:49, vadmium wrote:
> On 2016/11/22 13:13:41, storchaka wrote:
> > Shouldn't we use the ".. code-block:: c" directive?
> 
> I don’t think it is needed. At the top of the file there is already
“..
> highlightlang:: c”, and this already comes up highlighted for me. I
copied the
> markup from
>
<https://docs.python.org/3.7/c-api/typeobj.html#c.PyTypeObject.tp_descr_get>
> further down the page.

Nice.

> > Please document explicitly that attr_name point't to read-only
string, its
> > content shouldn't be modified.
> 
> Do you mean the function that implements tp_getattr should not modify
the
> string? I guess I can add that if you want, though it seems to be
going into
> more detail than normal. It seems reasonable to leave it out, along
with other
> details like the string is null-terminated and its lifetime is the
duration of
> the function call.

Left it on you. But this is not a normal case.

It would be simpler to change the signature of tp_getattr by adding
const. But this change should be discussed on Python-Dev.

http://bugs.python.org/review/28771/


More information about the docs mailing list