Merge lp:~maxb/launchpad/py2.6-importfascist into lp:launchpad
Proposed by
Max Bowsher
Status: | Merged |
---|---|
Approved by: | Guilherme Salgado |
Approved revision: | not available |
Merged at revision: | not available |
Proposed branch: | lp:~maxb/launchpad/py2.6-importfascist |
Merge into: | lp:launchpad |
Diff against target: |
26 lines (+3/-3) 1 file modified
lib/lp/scripts/utilities/importfascist.py (+3/-3) |
To merge this branch: | bzr merge lp:~maxb/launchpad/py2.6-importfascist |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guilherme Salgado (community) | code | Approve | |
Review via email: mp+18646@code.launchpad.net |
Commit message
Accept and propagate a 'level' parameter in importfascist. (New feature in Python 2.5, helps compatibility with 2.6)
To post a comment you must log in.
This branch upgrades the importfascist's __import__ hook to include the fifth argument 'level' which was introduced in Python 2.5.
We have survived without this change so far, as few things use it yet.
I am submitting this branch now as preparatory effort for the future move to Python 2.6, as internal parts of Python such as PyImport_ Import( modulename) start to use the level parameter there.
The semantics of level are as follows:
-1 : traditional behaviour
0 : absolute import, do not even try to consider as relative
>=1 : explicit relative import, stated number of levels up
Because the existing importfascist makes no attempt to support relative imports, and binning the current implementation has been discussed as a likely option, I have taken the simple route of just accepting and propagating the parameter without bothering to use it in any way.
This does not weaken the import fascist any more than it already is liable to fail to properly process relative imports.
This change was previously part of the python-migration2.6 sprint branch, now cherrypicked for landing on devel whilst still in the 2.5 era.