Opened 9 years ago

Closed 7 years ago

#17052 closed Bug (wontfix)

dictConfig does not correctly handle absolute imports

Reported by: David Cramer Owned by: nobody
Component: Utilities Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When you have a module, say, and you try to register that with dictConfig it will cause an import error due to the way the recursive importing was implemented.

While we're not using Django for this, we are using logutils (which is still the same code):

We patched it by simply using import correctly:

class NotBrokenDictConfig(logutils.dictconfig.DictConfigurator):
    def resolve(self, s):
        module, cls_name = s.rsplit('.', 1)
        return getattr(self.importer(module, {}, {}, [cls_name]), cls_name)

See also

Change History (4)

comment:1 Changed 9 years ago by Russell Keith-Magee

To clarify: you appear to be reporting an issue with dictconfig itself -- is this correct? If so, has it been reported and/or fixed in Python's native dictconfig?

Django's dictconfig is a literal copy of the one included in Python, included verbatim to ensure compatibility across Python versions. If there's a problem with the version bundled with Django, the preferred fix is to update to a new verbatim copy, not to patch Django's version.

comment:2 Changed 9 years ago by Aymeric Augustin

Triage Stage: UnreviewedAccepted

As this query shows, this wasn't reported in Python's bug tracker.

We'll have to backport the fix from Python eventually, so I'm marking this as accepted.

Version 0, edited 9 years ago by Aymeric Augustin (next)

comment:3 Changed 7 years ago by Aymeric Augustin

Component: UncategorizedUtilities

comment:4 Changed 7 years ago by Tim Graham

Resolution: wontfix
Status: newclosed

Marking as won't fix since our copy of dictconfig is deprecated.

Note: See TracTickets for help on using tickets.
Back to Top