mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Issue #27443: __length_hint__() of bytearray itearator no longer return
negative integer for resized bytearray.
This commit is contained in:
		
						commit
						6c94d10a19
					
				
					 3 changed files with 18 additions and 1 deletions
				
			
		|  | @ -1328,6 +1328,16 @@ def test_iterator_pickling2(self): | |||
| 
 | ||||
|     test_exhausted_iterator = test.list_tests.CommonTest.test_exhausted_iterator | ||||
| 
 | ||||
|     def test_iterator_length_hint(self): | ||||
|         # Issue 27443: __length_hint__ can return negative integer | ||||
|         ba = bytearray(b'ab') | ||||
|         it = iter(ba) | ||||
|         next(it) | ||||
|         ba.clear() | ||||
|         # Shouldn't raise an error | ||||
|         self.assertEqual(list(it), []) | ||||
| 
 | ||||
| 
 | ||||
| class AssortedBytesTest(unittest.TestCase): | ||||
|     # | ||||
|     # Test various combinations of bytes and bytearray | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka