mirror of
https://github.com/python/cpython.git
synced 2025-07-30 22:54:16 +00:00
Protect against attempts to replace PyNumber_Add with PyNumber_InPlaceAdd in builtin sum
This commit is contained in:
parent
a0e0f9eda4
commit
bfd2dc7479
1 changed files with 4 additions and 0 deletions
|
@ -1286,6 +1286,10 @@ class BuiltinTest(unittest.TestCase):
|
|||
raise ValueError
|
||||
self.assertRaises(ValueError, sum, BadSeq())
|
||||
|
||||
empty = []
|
||||
sum(([x] for x in range(10)), empty)
|
||||
self.assertEqual(empty, [])
|
||||
|
||||
def test_type(self):
|
||||
self.assertEqual(type(''), type('123'))
|
||||
self.assertNotEqual(type(''), type(()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue