mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bail in unicode error's __str__ methods if the objects are not properly initialized (closes #21134)
This commit is contained in:
parent
24dfb05d4f
commit
9b09ba1234
3 changed files with 21 additions and 0 deletions
|
@ -800,6 +800,12 @@ class ExceptionTests(unittest.TestCase):
|
|||
u.start = 1000
|
||||
self.assertEqual(str(u), "can't translate characters in position 1000-4: 965230951443685724997")
|
||||
|
||||
def test_unicode_errors_no_object(self):
|
||||
# See issue #21134.
|
||||
klasses = UnicodeDecodeError, UnicodeDecodeError, UnicodeTranslateError
|
||||
for klass in klasses:
|
||||
self.assertEqual(str(klass.__new__(klass)), "")
|
||||
|
||||
@no_tracing
|
||||
def test_badisinstance(self):
|
||||
# Bug #2542: if issubclass(e, MyException) raises an exception,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue