New submission from Serhiy Storchaka: Proposed patch makes the fields name and doc of structures PyMemberDef, PyGetSetDef, PyStructSequence_Field, PyStructSequence_Desc, and wrapperbase being of type "const char *" rather of "char *".
These structures often are initialized as static variables and name and doc fields are initialized from literal strings. These fields are always refer to constant string literal, NULL, or readonly UTF8 representation of a Unicode object. They are never refer to mutable data. Changing the data referred by these pointers is an error. Adding the const qualifier makes clear that this is an immutable data. This change may need some changes in third-party code. But it needs to change only one line in CPython sources, and I believe that most third-party projects don't need any changes at all. ---------- components: Interpreter Core files: const-name-and-doc-fields.patch keywords: patch messages: 281340 nosy: ncoghlan, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Add the const qualifier to fields name and doc of public structs type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file45581/const-name-and-doc-fields.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28761> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com