mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Fix for the unfortunate fact that PyDict_GetItem and PyObject_GetItem
have differing refcount semantics. If anyone sees a prettier way to acheive the same ends, then please go for it. I think this is the first time I've ever used Py_XINCREF.
This commit is contained in:
		
							parent
							
								
									77a602fbf2
								
							
						
					
					
						commit
						a3711f73c1
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		|  | @ -1742,8 +1742,10 @@ PyEval_EvalFrame(PyFrameObject *f) | ||||||
| 					     PyObject_REPR(w)); | 					     PyObject_REPR(w)); | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
| 			if (PyDict_CheckExact(v)) | 			if (PyDict_CheckExact(v)) { | ||||||
| 				x = PyDict_GetItem(v, w); | 				x = PyDict_GetItem(v, w); | ||||||
|  | 				Py_XINCREF(x); | ||||||
|  | 			} | ||||||
| 			else { | 			else { | ||||||
| 				x = PyObject_GetItem(v, w); | 				x = PyObject_GetItem(v, w); | ||||||
| 				if (x == NULL && PyErr_Occurred()) { | 				if (x == NULL && PyErr_Occurred()) { | ||||||
|  | @ -1763,8 +1765,8 @@ PyEval_EvalFrame(PyFrameObject *f) | ||||||
| 						break; | 						break; | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 			} |  | ||||||
| 				Py_INCREF(x); | 				Py_INCREF(x); | ||||||
|  | 			} | ||||||
| 			PUSH(x); | 			PUSH(x); | ||||||
| 			continue; | 			continue; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Michael W. Hudson
						Michael W. Hudson