mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
Issue #16060: Fix a double DECREF in int() implementation. Thanks Serhiy Storchaka.
This commit is contained in:
parent
3658cb3012
commit
7c95bb35e4
3 changed files with 18 additions and 4 deletions
|
@ -305,6 +305,18 @@ class IntTestCases(unittest.TestCase):
|
|||
self.fail("Failed to raise TypeError with %s" %
|
||||
((base, trunc_result_base),))
|
||||
|
||||
# Regression test for bugs.python.org/issue16060.
|
||||
class BadInt(trunc_result_base):
|
||||
def __int__(self):
|
||||
return 42.0
|
||||
|
||||
class TruncReturnsBadInt(base):
|
||||
def __trunc__(self):
|
||||
return BadInt()
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
int(TruncReturnsBadInt())
|
||||
|
||||
def test_error_message(self):
|
||||
testlist = ('\xbd', '123\xbd', ' 123 456 ')
|
||||
for s in testlist:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue