Ticket #426 (assigned defect)

Opened 5 years ago

Last modified 3 months ago

Replace __import__ with import_module

Reported by: george.sakkis@… Owned by: andrew
Priority: major Milestone: 1.0
Component: commands Version: mercurial
Keywords: Cc:

Description

The fromlist parameter of __import__ is poorly documented and implemented; specifically when importing a package and fromlist contains an empty string, the package is imported twice with a bogus __name__ the second time (see http://bugs.python.org/issue2090). This resulted to an obscure bug during an initial migration I ran.

Attached is a patch that replaces all __import__ calls with django.utils.importlib.import_module (also to be included in Python 2.7).

Attachments

manage.py (546 bytes) - added by ge 5 years ago.
import_module.patch (8.5 KB) - added by george.sakkis@… 5 years ago.
import_module patch

Change History

Changed 5 years ago by ge

Changed 5 years ago by george.sakkis@…

import_module patch

comment:1 Changed 5 years ago by george.sakkis@…

First attachment was added by mistake, ignore or delete it.

comment:2 Changed 5 years ago by andrew

  • Status changed from new to assigned
  • Milestone set to 0.7.1

I agree, but I'll have to bundle importlib with South, since it's not part of Django 1.0, which we still support.

comment:3 Changed 4 years ago by andrew

  • Milestone changed from 0.7.1 to 0.7.2

comment:4 Changed 4 years ago by andrew

  • Milestone changed from 0.7.2 to 1.0
Note: See TracTickets for help on using tickets.