Commits

Michał Górny  committed f19e496

StringCompat: raise AttributeError when accessing invalid str attrs.

StringCompat's __getattr__() may be called because of a random
AttributeError. Thus, we should raise AttributeError when user tries to
access an invalid attr. Otherwise, we may end up with an infinite
stringification loop.

  • Participants
  • Parent commits c891e72

Comments (0)

Files changed (1)

File gentoopm/util.py

 		return hasattr(str, k)
 
 	def __getattr__(self, k):
+		if not self.__hasattr__(k):
+			raise AttributeError(k)
 		return getattr(str(self), k)
 
 	# other useful special methods