mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Issue #18408: Fix _Py_DisplaySourceLine()
Report _Py_FindSourceFile() error, so the error is cleared; and clear io.open(filename) exception on failure.
This commit is contained in:
		
							parent
							
								
									7eab0d000c
								
							
						
					
					
						commit
						ceceaa00ba
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		|  | @ -246,10 +246,12 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent) | |||
|     binary = _PyObject_CallMethodId(io, &PyId_open, "Os", filename, "rb"); | ||||
| 
 | ||||
|     if (binary == NULL) { | ||||
|         PyErr_Clear(); | ||||
| 
 | ||||
|         binary = _Py_FindSourceFile(filename, buf, sizeof(buf), io); | ||||
|         if (binary == NULL) { | ||||
|             Py_DECREF(io); | ||||
|             return 0; | ||||
|             return -1; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner