mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	gh-94930: skipitem() in getargs.c should return non-NULL on error (GH-94931)
(cherry picked from commit 067f0da335)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
			
			
This commit is contained in:
		
							parent
							
								
									a914fa979e
								
							
						
					
					
						commit
						ec6ed6681d
					
				
					 4 changed files with 37 additions and 8 deletions
				
			
		|  | @ -878,9 +878,19 @@ def test_s_hash(self): | |||
|     def test_s_hash_int(self): | ||||
|         # "s#" without PY_SSIZE_T_CLEAN defined. | ||||
|         from _testcapi import getargs_s_hash_int | ||||
|         self.assertRaises(SystemError, getargs_s_hash_int, "abc") | ||||
|         self.assertRaises(SystemError, getargs_s_hash_int, x=42) | ||||
|         # getargs_s_hash_int() don't raise SystemError because skipitem() is not called. | ||||
|         from _testcapi import getargs_s_hash_int2 | ||||
|         buf = bytearray([1, 2]) | ||||
|         self.assertRaises(SystemError, getargs_s_hash_int, buf, "abc") | ||||
|         self.assertRaises(SystemError, getargs_s_hash_int, buf, x=42) | ||||
|         self.assertRaises(SystemError, getargs_s_hash_int, buf, x="abc") | ||||
|         self.assertRaises(SystemError, getargs_s_hash_int2, buf, ("abc",)) | ||||
|         self.assertRaises(SystemError, getargs_s_hash_int2, buf, x=42) | ||||
|         self.assertRaises(SystemError, getargs_s_hash_int2, buf, x="abc") | ||||
|         buf.append(3)  # still mutable -- not locked by a buffer export | ||||
|         # getargs_s_hash_int(buf) may not raise SystemError because skipitem() | ||||
|         # is not called. But it is an implementation detail. | ||||
|         # getargs_s_hash_int(buf) | ||||
|         # getargs_s_hash_int2(buf) | ||||
| 
 | ||||
|     def test_z(self): | ||||
|         from _testcapi import getargs_z | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Miss Islington (bot)
						Miss Islington (bot)