Ticket #9827: 9827_custom_name.patch

File 9827_custom_name.patch, 824 bytes (added by Jeroen Demeyer, 10 years ago)
  • sage/interfaces/interface.py

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1365168289 -7200
    # Node ID 9f597dd6e4451c7b84c703752f6cb359c1892d42
    # Parent  6bdbfe1b8ed3c81722fe9133c73b1f4926ab4cfb
    Fix KeyError in __repr__
    
    diff --git a/sage/interfaces/interface.py b/sage/interfaces/interface.py
    a b  
    876876        except AttributeError:
    877877            s = self.parent().get(self._name)
    878878        if s.__contains__(self._name):
    879             if hasattr(self, '__custom_name'):
    880                 s =  s.replace(self._name, self.__dict__['__custom_name'])
     879            try:
     880                s = s.replace(self._name, self.__custom_name)
     881            except AttributeError:
     882                pass
    881883        return s
    882884
    883885    def __getattr__(self, attrname):