In some cases a package is loaded that doesn't have all it's descendants
as attributes. When importing a descendant with fromlist == None then
an AttributeError is thrown in _import. This is the case for example
when importing django.template.defaulttags.
The proposed fix is to use sys.modules with the full name of the
immediate ancestor of the module, but only if the current method trows
an AttributeError.
In some cases a package is loaded that doesn't have all it's descendants as attributes. When importing a descendant with
fromlist == None
then anAttributeError
is thrown in_import
. This is the case for example when importingdjango.template.defaulttags
.The proposed fix is to use
sys.modules
with the full name of the immediate ancestor of the module, but only if the current method trows anAttributeError
.