mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Fix another refleak
This commit is contained in:
		
							parent
							
								
									538ba2afb5
								
							
						
					
					
						commit
						22a1d17bb5
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		|  | @ -2881,11 +2881,15 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals, | ||||||
|                 Py_INCREF(final_mod); |                 Py_INCREF(final_mod); | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|                 Py_ssize_t cut_off = PyUnicode_GetLength(name) - |                 Py_ssize_t cut_off = PyUnicode_GET_LENGTH(name) - | ||||||
|                                         PyUnicode_GetLength(front); |                                         PyUnicode_GET_LENGTH(front); | ||||||
|                 Py_ssize_t abs_name_len = PyUnicode_GetLength(abs_name); |                 Py_ssize_t abs_name_len = PyUnicode_GET_LENGTH(abs_name); | ||||||
|                 PyObject *to_return = PyUnicode_Substring(abs_name, 0, |                 PyObject *to_return = PyUnicode_Substring(abs_name, 0, | ||||||
|                                                         abs_name_len - cut_off); |                                                         abs_name_len - cut_off); | ||||||
|  |                 Py_DECREF(front); | ||||||
|  |                 if (to_return == NULL) { | ||||||
|  |                     goto error_with_unlock; | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|                 final_mod = PyDict_GetItem(interp->modules, to_return); |                 final_mod = PyDict_GetItem(interp->modules, to_return); | ||||||
|                 Py_DECREF(to_return); |                 Py_DECREF(to_return); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Antoine Pitrou
						Antoine Pitrou