File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,13 @@ def test_readinto(self):
253253            self.assertEqual(s, 0)
254254            self.assertEqual(bytes(buffer), b"notspam\0")
255255
256+             # Readinto a 0 length bytearray when at EOF should return 0
257+             self.assertEqual(os.readinto(fd, bytearray()), 0)
258+ 
259+             # Readinto a 0 length bytearray with data available should return 0.
260+             os.lseek(fd, 0, 0)
261+             self.assertEqual(os.readinto(fd, bytearray()), 0)
262+ 
256263    def test_readinto_badbuffer(self):
257264        with open(os_helper.TESTFN, "w+b") as fobj:
258265            fobj.write(b"spam")
@@ -302,7 +309,7 @@ def test_large_readinto(self, size):
302309        create_file(os_helper.TESTFN, b'test')
303310
304311        # Issue #21932: For readinto the buffer contains the length rather than
305-         # a length being passed explicitly to read, shold  still get capped to a
312+         # a length being passed explicitly to read, should  still get capped to a
306313        # valid size / not raise an OverflowError for sizes larger than INT_MAX.
307314        buffer = bytearray(INT_MAX+10)
308315        with open(os_helper.TESTFN, "rb") as fp:
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments