mirror of
https://github.com/python/cpython.git
synced 2025-09-15 05:06:12 +00:00
Remove the __unicode__ method from exceptions. Allows unicode() to be called
on exception classes. Would require introducing a tp_unicode slot to make it work otherwise. Fixes bug #1551432 and will be backported.
This commit is contained in:
parent
af57f6065f
commit
ca2ca79d23
3 changed files with 10 additions and 19 deletions
|
@ -304,6 +304,15 @@ class ExceptionTests(unittest.TestCase):
|
|||
return -1
|
||||
self.assertRaises(RuntimeError, g)
|
||||
|
||||
def testUnicodeStrUsage(self):
|
||||
# Make sure both instances and classes have a str and unicode
|
||||
# representation.
|
||||
self.failUnless(str(Exception))
|
||||
self.failUnless(unicode(Exception))
|
||||
self.failUnless(str(Exception('a')))
|
||||
self.failUnless(unicode(Exception(u'a')))
|
||||
|
||||
|
||||
def test_main():
|
||||
run_unittest(ExceptionTests)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue