auto-importer doesn't support modules not imported by their parent
Bug #733026 reported by
Andrew Wilkins
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pushy |
Fix Released
|
Medium
|
Unassigned |
Bug Description
You have a package "a", and a module within called "b", i.e.:-
a/__init__.py
a/b.py
a/__init__.py does NOT import b.py.
The auto-importer currently is a bit dumb, assuming that the parent imports the child. Based on this assumption, a auto-import of "a.b" works as follows:
getattr(
This will fail if a doesn't import b.
Related branches
Changed in pushy: | |
status: | New → Incomplete |
importance: | Undecided → Medium |
Changed in pushy: | |
status: | Confirmed → In Progress |
Changed in pushy: | |
status: | In Progress → Fix Committed |
Changed in pushy: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
It is possible to get around this at the moment, by doing this: conn.modules, "a.b").b
getattr(
The second getattr is necessary since __import__ is used.
I can think of a couple of options for fixing this:
- Modify ModuleType proxies to do an import on getattr, if getattr otherwise fails.
- Add an explicit import function to pushy.Client which handles sub-modules.
I am currently thinking of doing both. If feasible, the first option should only apply to modules returned from the auto-importer.