#8193: `__import__(mod, {}, {}, [''])` causes double import of modules ('module'
and 'module' + '.')
------------------------------------+---------------------------------------
Reporter: i_i | Owner: nobody
Status: new | Milestone: post-1.0
Component: Uncategorized | Version: SVN
Resolution: | Keywords: import
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 1 |
------------------------------------+---------------------------------------
Comment (by i_i):
`__import__(mod, {}, {}, [mod.split('.')[-1]])` works perfectly in any
situation:
{{{
>>> for mod in ('django', 'django.utils', 'django.utils.encoding'):
... print __import__(mod, {}, {}, [mod.split('.')[-1]])
...
<module 'django' from '/usr/lib/python2.5/site-
packages/django/__init__.pyc'>
<module 'django.utils' from '/usr/lib/python2.5/site-
packages/django/utils/__init__.pyc'>
<module 'django.utils.encoding' from '/usr/lib/python2.5/site-
packages/django/utils/encoding.pyc'>
}}}
Just like `__import__(mod, {}, {}, [''])` only without ugly side-effects.
The change is *very* simple and working/tested, I don't understand the
reasons to wait.
--
Ticket URL: <http://code.djangoproject.com/ticket/8193#comment:11>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---