[issue42243] Don't access the module dictionary directly

Serhiy Storchaka report at bugs.python.org
Mon Nov 2 04:02:42 EST 2020


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Are all these occurrences in the module initialization code?

I think there is nothing wrong with this. Yes, the code can be a little clearer if use PyObject_GetArrt or PyModule_Add*, but rewriting can introduce new bugs.

The remark in the documentation is rather about reading the module attributes and writing a new code. It does not require rewriting existing code.

You can do this, but it will be treated as pure cosmetic change. It can be accepted if the new code is much clearer.

----------
nosy: +serhiy.storchaka

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


More information about the Python-bugs-list mailing list