Django

Code

Ticket #2968 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

[patch] 2nd/3rd arguments for __import__ are '' (empty string) instead of {} (empty dictionary)

Reported by: Yasushi Masuda <ymasuda@ethercube.com> Assigned to: adrian
Milestone: Component: Core framework
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description (Last modified by adrian)

According to Python library reference, the 2nd/3rd arguments of import should be a dictionary (whatever globals() or locals() returns), but '' (empty strings) are used instead in some part of the code. It's not fatal because current CPython implementation does not care what type those argument are, however, it may change in future, or in alternative Python implementation such as IronPython? or Jython (actually, Jython raises ValueError? for __import__(mod, '', '', [''])).

Relevant files include: {{{conf/init.py, core/management.py, core/urlresolvers.py, db/init.py, template/init.py, template/context.py, template/loader.py, templatetags/init.py, test/doctest.py, test/simple.py, views/debug.py, contrib/auth/init.py, core/cache/init.py, core/handlers/base.py, core/serializers/init.py, db/models/loading.py, template/loaders/app_directories.py, contrib/admin/views/doc.py}}}, and contrib/admin/views/template.py.

Attachments

fix_import_args.diff (14.9 kB) - added by Yasushi Masuda <ymasuda@ethercube.com> on 10/30/06 01:27:49.
Patch to fix import args

Change History

10/30/06 01:27:49 changed by Yasushi Masuda <ymasuda@ethercube.com>

  • attachment fix_import_args.diff added.

Patch to fix import args

10/30/06 01:28:46 changed by ymasuda <ymasuda@ethercube.com>

  • summary changed from 2nd/3rd arguments for __import__ are '' (empty string) instead of {} (empty dictionary) to [patch] 2nd/3rd arguments for __import__ are '' (empty string) instead of {} (empty dictionary).

10/30/06 14:45:08 changed by adrian

  • description changed.

Fixed formatting in description.

10/30/06 14:50:27 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

(In [3951]) Fixed #2968 -- Changed arguments to import to use empty dictionary instead of empty string, for stricter compliance with Python library reference. Thanks for the patch, Yasushi Masuda


Add/Change #2968 ([patch] 2nd/3rd arguments for __import__ are '' (empty string) instead of {} (empty dictionary))




Change Properties
Action