Christian Heimes added the comment:
Is there anything left to do for this ticket?
--
assignee: christian.heimes -
status: open - pending
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18426
Ivan Johansen added the comment:
Probably not. I am setting status to closed with resolution fixed.
--
resolution: - fixed
status: pending - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18426
New submission from Ivan Johansen:
In Python/importdl.c around line 99 in the function
_PyImport_LoadDynamicModule() you can find the code:
def = PyModule_GetDef(m);
def-m_base.m_init = p;
If the module m, which is returned from a newly imported extension, is not
created by
Roundup Robot added the comment:
New changeset 4343dfaca8e2 by Christian Heimes in branch '3.3':
Issue #18426: Fix NULL pointer dereference in C extension import when
http://hg.python.org/cpython/rev/4343dfaca8e2
New changeset 9fb3656b178a by Christian Heimes in branch 'default':
Issue #18426:
Christian Heimes added the comment:
I used a slightly different patch:
if (def == NULL)
goto error;
--
nosy: +christian.heimes
resolution: - fixed
stage: - committed/rejected
status: open - closed
versions: -Python 3.1, Python 3.2, Python 3.5
Amaury Forgeot d'Arc added the comment:
I'm not sure the fix is correct: PyModule_GetDef() can return NULL without
setting an error, for example when the init function returns a regular Python
module.
I'm OK to require the init function to return a module created with
PyModule_Create(), and
Changes by Amaury Forgeot d'Arc amaur...@gmail.com:
--
status: closed - open
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18426
___
___
Christian Heimes added the comment:
In theory you are right. m-md_def could be NULL, too. But in practice it's
only going to happen when you have a faulty C extension. The code tries to load
a dynamic module (ELF shared library, Windows DLL, ...) with
_PyImport_GetDynLoadFunc() a couple of
Changes by Christian Heimes li...@cheimes.de:
--
assignee: - christian.heimes
resolution: fixed -
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18426
___
Amaury Forgeot d'Arc added the comment:
I was thinking of a message similar to the one above.
The eventual exception set by PyModule_GetDef(m) is less explicit.
if (def == NULL) {
PyErr_Format(PyExc_SystemError,
initialization of %s did not return an extension module,
Roundup Robot added the comment:
New changeset fce581643cb6 by Christian Heimes in branch '3.3':
Issue #18426: improve exception message. Courtesy of Amaury
http://hg.python.org/cpython/rev/fce581643cb6
New changeset 7a50d3c0aa61 by Christian Heimes in branch 'default':
Issue #18426: improve
Ivan Johansen added the comment:
If possible it would be nice if any module could be returned from a C
extension. Specifically I was trying to subclass module (PyModule_Type) and use
that.
But an error message is better than a crash.
--
___
Python
Amaury Forgeot d'Arc added the comment:
Returning another kind of module can be dangerous here, because extension
modules are handled specially (see _PyImport_FixupExtensionObject),
and it's not obvious what this does to normal modules.
But I agree that _imp.load_dynamic() could be extended to
13 matches
Mail list logo