use parent.__setattr__ instead of __dict__

This commit is contained in:
Benoit Boissinot 2006-12-14 23:51:41 +01:00
parent 19123a0330
commit 4bf7b440fe

View File

@ -35,8 +35,8 @@ class _demandmod(object):
else: else:
head = name head = name
after = [] after = []
self.__dict__["_data"] = (head, globals, locals, after) object.__setattr__(self, "_data", (head, globals, locals, after))
self.__dict__["_module"] = None object.__setattr__(self, "_module", None)
def _extend(self, name): def _extend(self, name):
"""add to the list of submodules to load""" """add to the list of submodules to load"""
self._data[3].append(name) self._data[3].append(name)
@ -54,7 +54,7 @@ class _demandmod(object):
# are we in the locals dictionary still? # are we in the locals dictionary still?
if locals and locals.get(head) == self: if locals and locals.get(head) == self:
locals[head] = mod locals[head] = mod
self.__dict__["_module"] = mod object.__setattr__(self, "_module", mod)
def __repr__(self): def __repr__(self):
return "<unloaded module '%s'>" % self._data[0] return "<unloaded module '%s'>" % self._data[0]
def __call__(self, *args, **kwargs): def __call__(self, *args, **kwargs):