[Python-Dev] Patch 1644818: Allow importing built-in submodules
Miguel Lobo
mlobol at gmail.com
Tue Mar 6 15:28:32 CET 2007
Hi list,
A month and a half ago, I submitted patch 1644818 to the CPython Patch
Tracker:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1644818&group_id=5470
On several occassions I have been advised to mention the patch in this list,
so here it is:
The problem: Importing built-in submodule extensions (e.g. PyQt4.QtCore and
PyQt4.QtGui in my case) does not work. By built-in I mean statically linked
against the Python executable.
The cause: find_module in import.c only checks the module name (e.g. QtCore)
against the built-in list, which should contain the full name (e.g.
PyQt4.QtCore) instead. Also, the above check is performed after the code to
check if the parent module is frozen, which would have already exited in
that case.
Solution: By moving the "is_builtin()" check to earlier in find_module and
using the "fullname" variable instead of "name", I can build PyQt4.QtCoreand
PyQt4.QtGui into the interpreter and import and use them with no problem
whatsoever, even if their parent module (PyQt4) is frozen.
When I submitted the patch, I ran the regression tests and everything seemed
Ok. Also, the patch is for Python-2.5, but it a month and a half ago it was
applicable to the svn trunk with only a one-line offset.
As I am completely new to CPython development, perhaps this problem has
already been discussed and/or fixed I may have done something incorrectly.
Please let me know if that is the case.
Regards,
Miguel Lobo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20070306/ae613224/attachment.htm
More information about the Python-Dev
mailing list