[New-bugs-announce] [issue27782] Multi-phase extension module initialization, inconsistent exceptions and conflicts between code and PEP

Xiang Zhang report at bugs.python.org
Wed Aug 17 02:04:37 EDT 2016


New submission from Xiang Zhang:

>From doc [1], when create_module returns a non-module instance,  m_methods, m_traverse, m_clear, m_free must be NULL. But actually in the codes, only m_traverse, m_clear, m_free are checked and emitting consistent errors. If m_methods is NULL, it will fail in [2] and emit an inconsistent misleading argument error. And what's more confusing is, in [3], it says "regardless of type, the module's functions are initialized from m_methods, if any", which I think conflicts with the codes and doc.

[1] https://docs.python.org/3.6/c-api/module.html#c.Py_mod_create
[2] https://hg.python.org/cpython/file/tip/Objects/moduleobject.c#l300
[3] https://www.python.org/dev/peps/pep-0489/#post-creation-steps

----------
components: Interpreter Core
messages: 272903
nosy: encukou, ncoghlan, xiang.zhang
priority: normal
severity: normal
status: open
title: Multi-phase extension module initialization, inconsistent exceptions and conflicts between code and PEP
type: behavior
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27782>
_______________________________________


More information about the New-bugs-announce mailing list