mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	gh-128911: Add PyImport_ImportModuleAttr() function (#128912)
Add PyImport_ImportModuleAttr() and PyImport_ImportModuleAttrString() functions. * Add unit tests. * Replace _PyImport_GetModuleAttr() with PyImport_ImportModuleAttr(). * Replace _PyImport_GetModuleAttrString() with PyImport_ImportModuleAttrString(). * Remove "pycore_import.h" includes, no longer needed.
This commit is contained in:
		
							parent
							
								
									f927204f64
								
							
						
					
					
						commit
						3bebe46d34
					
				
					 40 changed files with 194 additions and 56 deletions
				
			
		|  | @ -2285,7 +2285,7 @@ array_array___reduce_ex___impl(arrayobject *self, PyTypeObject *cls, | |||
|     assert(state != NULL); | ||||
| 
 | ||||
|     if (state->array_reconstructor == NULL) { | ||||
|         state->array_reconstructor = _PyImport_GetModuleAttrString( | ||||
|         state->array_reconstructor = PyImport_ImportModuleAttrString( | ||||
|                 "array", "_array_reconstructor"); | ||||
|         if (state->array_reconstructor == NULL) { | ||||
|             return NULL; | ||||
|  | @ -3206,7 +3206,7 @@ array_modexec(PyObject *m) | |||
|         return -1; | ||||
|     } | ||||
| 
 | ||||
|     PyObject *mutablesequence = _PyImport_GetModuleAttrString( | ||||
|     PyObject *mutablesequence = PyImport_ImportModuleAttrString( | ||||
|             "collections.abc", "MutableSequence"); | ||||
|     if (!mutablesequence) { | ||||
|         Py_DECREF((PyObject *)state->ArrayType); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner