mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	bpo-38858: Reorganize pycore_init_types() (GH-17265)
* Call _PyLong_Init() and _PyExc_Init() earlier * new_interpreter() reuses pycore_init_types()
This commit is contained in:
		
							parent
							
								
									ac2235432c
								
							
						
					
					
						commit
						ef5aa9af7c
					
				
					 1 changed files with 11 additions and 20 deletions
				
			
		|  | @ -565,19 +565,15 @@ pycore_init_types(void) | |||
|         return status; | ||||
|     } | ||||
| 
 | ||||
|     if (!_PyLong_Init()) { | ||||
|         return _PyStatus_ERR("can't init longs"); | ||||
|     } | ||||
| 
 | ||||
|     status = _PyUnicode_Init(); | ||||
|     if (_PyStatus_EXCEPTION(status)) { | ||||
|         return status; | ||||
|     } | ||||
| 
 | ||||
|     if (_PyStructSequence_Init() < 0) { | ||||
|         return _PyStatus_ERR("can't initialize structseq"); | ||||
|     } | ||||
| 
 | ||||
|     if (!_PyLong_Init()) { | ||||
|         return _PyStatus_ERR("can't init longs"); | ||||
|     } | ||||
| 
 | ||||
|     status = _PyExc_Init(); | ||||
|     if (_PyStatus_EXCEPTION(status)) { | ||||
|         return status; | ||||
|  | @ -587,8 +583,8 @@ pycore_init_types(void) | |||
|         return _PyStatus_ERR("can't init float"); | ||||
|     } | ||||
| 
 | ||||
|     if (!_PyContext_Init()) { | ||||
|         return _PyStatus_ERR("can't init context"); | ||||
|     if (_PyStructSequence_Init() < 0) { | ||||
|         return _PyStatus_ERR("can't initialize structseq"); | ||||
|     } | ||||
| 
 | ||||
|     status = _PyErr_Init(); | ||||
|  | @ -596,6 +592,10 @@ pycore_init_types(void) | |||
|         return status; | ||||
|     } | ||||
| 
 | ||||
|     if (!_PyContext_Init()) { | ||||
|         return _PyStatus_ERR("can't init context"); | ||||
|     } | ||||
| 
 | ||||
|     return _PyStatus_OK(); | ||||
| } | ||||
| 
 | ||||
|  | @ -1447,16 +1447,7 @@ new_interpreter(PyThreadState **tstate_p) | |||
|     } | ||||
|     config = &interp->config; | ||||
| 
 | ||||
|     status = _PyExc_Init(); | ||||
|     if (_PyStatus_EXCEPTION(status)) { | ||||
|         return status; | ||||
|     } | ||||
| 
 | ||||
|     status = _PyErr_Init(); | ||||
|     if (_PyStatus_EXCEPTION(status)) { | ||||
|         return status; | ||||
|     } | ||||
| 
 | ||||
|     status = pycore_init_types(); | ||||
| 
 | ||||
|     /* XXX The following is lax in error checking */ | ||||
|     PyObject *modules = PyDict_New(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner