mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	#2196 hasattr now allows SystemExit and KeyboardInterrupt to propagate
This commit is contained in:
		
							parent
							
								
									42bfa90f02
								
							
						
					
					
						commit
						b9030f4f0d
					
				
					 3 changed files with 20 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -877,9 +877,13 @@ builtin_hasattr(PyObject *self, PyObject *args)
 | 
			
		|||
	}
 | 
			
		||||
	v = PyObject_GetAttr(v, name);
 | 
			
		||||
	if (v == NULL) {
 | 
			
		||||
		PyErr_Clear();
 | 
			
		||||
		Py_INCREF(Py_False);
 | 
			
		||||
		return Py_False;
 | 
			
		||||
		if (!PyErr_ExceptionMatches(PyExc_Exception))
 | 
			
		||||
			return NULL;
 | 
			
		||||
		else {
 | 
			
		||||
			PyErr_Clear();
 | 
			
		||||
			Py_INCREF(Py_False);
 | 
			
		||||
			return Py_False;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	Py_DECREF(v);
 | 
			
		||||
	Py_INCREF(Py_True);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue