mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Fix some style nits:
* lines too long * wrong indentation * space after a function name * wrong function name in error string * simplifying some logic Also add an error check to PyDict_SetItemString.
This commit is contained in:
		
							parent
							
								
									1ff06c7fc8
								
							
						
					
					
						commit
						75c7c80ee5
					
				
					 1 changed files with 15 additions and 13 deletions
				
			
		|  | @ -345,18 +345,17 @@ PyImport_GetModulesReloading(void) | ||||||
| { | { | ||||||
| 	PyInterpreterState *interp = PyThreadState_Get()->interp; | 	PyInterpreterState *interp = PyThreadState_Get()->interp; | ||||||
| 	if (interp->modules_reloading == NULL) | 	if (interp->modules_reloading == NULL) | ||||||
| 		Py_FatalError("PyImport_GetModuleDict: no modules_reloading dictionary!"); | 		Py_FatalError("PyImport_GetModulesReloading: " | ||||||
|  | 			      "no modules_reloading dictionary!"); | ||||||
| 	return interp->modules_reloading; | 	return interp->modules_reloading; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void | static void | ||||||
| imp_modules_reloading_clear (void) | imp_modules_reloading_clear(void) | ||||||
| { | { | ||||||
| 	PyInterpreterState *interp = PyThreadState_Get()->interp; | 	PyInterpreterState *interp = PyThreadState_Get()->interp; | ||||||
| 	if (interp->modules_reloading == NULL) | 	if (interp->modules_reloading != NULL) | ||||||
| 		return; | 		PyDict_Clear(interp->modules_reloading); | ||||||
| 	PyDict_Clear(interp->modules_reloading); |  | ||||||
| 	return; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* Helper for sys */ | /* Helper for sys */ | ||||||
|  | @ -2444,12 +2443,15 @@ PyImport_ReloadModule(PyObject *m) | ||||||
| 			     name); | 			     name); | ||||||
| 		return NULL; | 		return NULL; | ||||||
| 	} | 	} | ||||||
| 	if ((existing_m = PyDict_GetItemString(modules_reloading, name)) != NULL) { | 	existing_m = PyDict_GetItemString(modules_reloading, name); | ||||||
|         /* Due to a recursive reload, this module is already being reloaded. */ | 	if (existing_m != NULL) { | ||||||
|         Py_INCREF(existing_m); | 		/* Due to a recursive reload, this module is already
 | ||||||
|         return existing_m; | 		   being reloaded. */ | ||||||
|  | 		Py_INCREF(existing_m); | ||||||
|  | 		return existing_m; | ||||||
|  	} |  	} | ||||||
|  	PyDict_SetItemString(modules_reloading, name, m); |  	if (PyDict_SetItemString(modules_reloading, name, m) < 0) | ||||||
|  | 		return NULL; | ||||||
| 
 | 
 | ||||||
| 	subname = strrchr(name, '.'); | 	subname = strrchr(name, '.'); | ||||||
| 	if (subname == NULL) | 	if (subname == NULL) | ||||||
|  | @ -2460,7 +2462,7 @@ PyImport_ReloadModule(PyObject *m) | ||||||
| 		if (parentname == NULL) { | 		if (parentname == NULL) { | ||||||
| 			imp_modules_reloading_clear(); | 			imp_modules_reloading_clear(); | ||||||
| 			return NULL; | 			return NULL; | ||||||
|         } |         	} | ||||||
| 		parent = PyDict_GetItem(modules, parentname); | 		parent = PyDict_GetItem(modules, parentname); | ||||||
| 		if (parent == NULL) { | 		if (parent == NULL) { | ||||||
| 			PyErr_Format(PyExc_ImportError, | 			PyErr_Format(PyExc_ImportError, | ||||||
|  | @ -2499,7 +2501,7 @@ PyImport_ReloadModule(PyObject *m) | ||||||
| 		 */ | 		 */ | ||||||
| 		PyDict_SetItemString(modules, name, m); | 		PyDict_SetItemString(modules, name, m); | ||||||
| 	} | 	} | ||||||
| 	imp_modules_reloading_clear (); | 	imp_modules_reloading_clear(); | ||||||
| 	return newm; | 	return newm; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Neal Norwitz
						Neal Norwitz