mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Merged revisions 74046 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r74046 | hirokazu.yamamoto | 2009-07-17 15:55:42 +0900 | 13 lines Merged revisions 74040,74042 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r74040 | hirokazu.yamamoto | 2009-07-17 15:20:46 +0900 | 1 line Issue #6415: Fixed warnings.warn sagfault on bad formatted string. ........ r74042 | hirokazu.yamamoto | 2009-07-17 15:26:54 +0900 | 1 line NEWS about r74040. ........ ................
This commit is contained in:
parent
a1c3805ba5
commit
680ac292ac
3 changed files with 18 additions and 0 deletions
|
@ -338,6 +338,20 @@ class WarnTests(unittest.TestCase):
|
|||
self.module.warn_explicit,
|
||||
None, Warning, None, 1, registry=42)
|
||||
|
||||
def test_bad_str(self):
|
||||
# issue 6415
|
||||
# Warnings instance with a bad format string for __str__ should not
|
||||
# trigger a bus error.
|
||||
class BadStrWarning(Warning):
|
||||
"""Warning with a bad format string for __str__."""
|
||||
def __str__(self):
|
||||
return ("A bad formatted string %(err)" %
|
||||
{"err" : "there is no %(err)s"})
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
self.module.warn(BadStrWarning())
|
||||
|
||||
|
||||
class CWarnTests(BaseTest, WarnTests):
|
||||
module = c_warnings
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue