[issue18426] Crash when extension does not use PyModule_Create()

2013-10-22 Thread Ivan Johansen
Ivan Johansen added the comment: Probably not. I am setting status to closed with resolution fixed. -- resolution: -> fixed status: pending -> closed ___ Python tracker ___

[issue18426] Crash when extension does not use PyModule_Create()

2013-10-22 Thread Christian Heimes
Christian Heimes added the comment: Is there anything left to do for this ticket? -- assignee: christian.heimes -> status: open -> pending ___ Python tracker ___ ___

[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Amaury Forgeot d'Arc
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

[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Ivan Johansen
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

[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Roundup Robot
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 exc

[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Amaury Forgeot d'Arc
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", short

[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Christian Heimes
Changes by Christian Heimes : -- assignee: -> christian.heimes resolution: fixed -> ___ Python tracker ___ ___ Python-bugs-list mail

[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Christian Heimes
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 li

[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Amaury Forgeot d'Arc
Changes by Amaury Forgeot d'Arc : -- status: closed -> open ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Amaury Forgeot d'Arc
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 f

[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Christian Heimes
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 _

[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Roundup Robot
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: F

[issue18426] Crash when extension does not use PyModule_Create()

2013-07-10 Thread Ivan Johansen
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 PyModule_Creat