1 Jul 2008 22:29
[ swig-Patches-2008229 ] For python, use a relative import for the C-extension
SourceForge.net <noreply <at> sourceforge.net>
2008-07-01 20:29:35 GMT
2008-07-01 20:29:35 GMT
Patches item #2008229, was opened at 2008-07-01 20:29 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=301645&aid=2008229&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Richard Boulton (richardb) Assigned to: Nobody/Anonymous (nobody) Summary: For python, use a relative import for the C-extension Initial Comment: Currently, when shadow classing is enabled in python, the generated python module imports the compiled C-extension by doing "import module". In python versions up-to and including 2.5, this generally works fine, because python will do relative imports by default (ie, look in the same directory as the module performing the import, as well as on sys.path). However, in 2.6, implicit relative imports will raise a warning, and in 2.7 onwards they will be invalid. Therefore, the generated code will only work if the compiled C-extension is present on sys.path. It will therefore no longer be valid to place an extension inside a parent module and include it from elsewhere in that module - modules will need to be installed globally. In python 2.5 onwards, (but not in python 2.4 or earlier), explicit relative imports can be performed by(Continue reading)
RSS Feed