Add a custom __str__ method to KeyError that applies repr() to the

missing key.  (Also added a guard to SyntaxError__str__ to prevent
calling PyString_Check(NULL).)
This commit is contained in:
Guido van Rossum 2002-09-03 20:24:09 +00:00
parent 99dba27e9a
commit 602d45194c
2 changed files with 41 additions and 3 deletions

View file

@ -10,7 +10,7 @@ spam
ImportError
spam
IndexError
spam
'spam'
KeyError
spam
KeyboardInterrupt