mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Better error message
This commit is contained in:
		
							parent
							
								
									ac8657bb0e
								
							
						
					
					
						commit
						c44dbc46fe
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		|  | @ -514,11 +514,17 @@ int | ||||||
| PyModule_AddObject(PyObject *m, char *name, PyObject *o) | PyModule_AddObject(PyObject *m, char *name, PyObject *o) | ||||||
| { | { | ||||||
| 	PyObject *dict; | 	PyObject *dict; | ||||||
| 	if (!PyModule_Check(m) || o == NULL) { | 	if (!PyModule_Check(m)) { | ||||||
| 		PyErr_SetString(PyExc_TypeError, | 		PyErr_SetString(PyExc_TypeError, | ||||||
| 			    "PyModule_AddObject() needs module as first arg"); | 			    "PyModule_AddObject() needs module as first arg"); | ||||||
| 		return -1; | 		return -1; | ||||||
| 	} | 	} | ||||||
|  | 	if (!o) { | ||||||
|  | 		PyErr_SetString(PyExc_TypeError, | ||||||
|  | 				"PyModule_AddObject() needs non-NULL value"); | ||||||
|  | 		return -1; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	dict = PyModule_GetDict(m); | 	dict = PyModule_GetDict(m); | ||||||
| 	if (dict == NULL) { | 	if (dict == NULL) { | ||||||
| 		/* Internal error -- modules must have a dict! */ | 		/* Internal error -- modules must have a dict! */ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jeremy Hylton
						Jeremy Hylton