[New-bugs-announce] [issue36347] Add the constant READWRITE for PyMemberDef

Stéphane Wirtel report at bugs.python.org
Mon Mar 18 10:42:30 EDT 2019


New submission from Stéphane Wirtel <stephane at wirtel.be>:

When we define some members with PyMemberDef, we have to specify the flag for read-write or read-only. 

static PyMemberDef members[] = {
    {"name", T_OBJECT, offsetof(MyObject, name), 0, "Name object"},
    {NULL}  // Sentinel
};

For a newcomer, when you read the doc, you don't know the meaning of `0` and you want to know, of course you read the code and sometimes you can find READONLY or `0`.

I would like to add a new constant for `0` and name it `READWRITE`.

static PyMemberDef members[] = {
    {"name", T_OBJECT, offsetof(MyObject, name), READWRITE, "Name object"},
    {NULL}  // Sentinel
};

----------
components: Interpreter Core
messages: 338232
nosy: matrixise
priority: normal
severity: normal
status: open
title: Add the constant READWRITE for PyMemberDef
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36347>
_______________________________________


More information about the New-bugs-announce mailing list