mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Issue #21951: Fix AsObj() of the _tkinter module: raise MemoryError on memory
allocation failure
This commit is contained in:
		
							parent
							
								
									53c87d1be2
								
							
						
					
					
						commit
						60a64d6812
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		|  | @ -913,8 +913,10 @@ AsObj(PyObject *value) | ||||||
|             return NULL; |             return NULL; | ||||||
|         } |         } | ||||||
|         argv = (Tcl_Obj **) ckalloc(((size_t)size) * sizeof(Tcl_Obj *)); |         argv = (Tcl_Obj **) ckalloc(((size_t)size) * sizeof(Tcl_Obj *)); | ||||||
|         if(!argv) |         if(!argv) { | ||||||
|           return 0; |           PyErr_NoMemory(); | ||||||
|  |           return NULL; | ||||||
|  |         } | ||||||
|         for (i = 0; i < size; i++) |         for (i = 0; i < size; i++) | ||||||
|           argv[i] = AsObj(PySequence_Fast_GET_ITEM(value,i)); |           argv[i] = AsObj(PySequence_Fast_GET_ITEM(value,i)); | ||||||
|         result = Tcl_NewListObj(size, argv); |         result = Tcl_NewListObj(size, argv); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner