Ticket #11: explicit_location_for_partial_name_warning.patch

File explicit_location_for_partial_name_warning.patch, 1.4 KB (added by ludovic.lhours@…, 15 years ago)
  • utils/lib/python/soclib_desc/module.py

     
    107107        def getModuleName(self):
    108108                return self.__typename
    109109
    110         def fullyQualifiedModuleName(self, name):
     110        def fullyQualifiedModuleName(self, name, owner=None):
    111111                if not ':' in name:
    112                         warnings.warn(PartialNameWarning(name), stacklevel = 2)
     112                        if owner and hasattr(owner, 'where'):
     113                                warnings.warn_explicit(PartialNameWarning(name),
     114                                        UserWarning, owner.where[0], owner.where[1])
     115                        else:
     116                                warnings.warn(PartialNameWarning(name), stacklevel = 2)
    113117                        mode = self.__typename.split(':',1)[0]
    114118                        return mode + ':' + name
    115119                return name
  • utils/lib/python/soclib_desc/component.py

     
    4242                self.__owner = None
    4343                self.__auto = auto
    4444                self.__args = args
     45                self.where = traceback.extract_stack()[-2][0:2]
    4546        def setModule(self, module):
    46                 self.__type = module.fullyQualifiedModuleName(self.__type)
     47                self.__type = module.fullyQualifiedModuleName(self.__type, self)
    4748                self.__module = module
    4849        def getUse(self, module):
    4950                from specialization import Specialization