mirror of
				https://github.com/python/cpython.git
				synced 2025-10-29 17:38:56 +00:00 
			
		
		
		
	 6a27efa2d3
			
		
	
	
		6a27efa2d3
		
	
	
	
	
		
			
			The patch fixes several issues with Py_NewInterpreter as well as the demo for multiple subinterpreters. Most of the patch was written by MvL with help from Benjamin, Amaury and me. Graham Dumpleton has verified that this patch fixes an issue with mod_wsgi.
		
			
				
	
	
		
			23 lines
		
	
	
	
		
			429 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
	
		
			429 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #include <Python.h>
 | |
| 
 | |
| #if 0
 | |
| char* cmd = "import codecs, encodings.utf_8, types; print(types)";
 | |
| #else
 | |
| char* cmd = "import types; print(types)";
 | |
| #endif
 | |
| 
 | |
| int main()
 | |
| {
 | |
| 	printf("Initialize interpreter\n");
 | |
| 	Py_Initialize();
 | |
| 	PyEval_InitThreads();
 | |
| 	PyRun_SimpleString(cmd);
 | |
| 	Py_EndInterpreter(PyThreadState_Get());
 | |
| 
 | |
| 	printf("\nInitialize subinterpreter\n");
 | |
| 	Py_NewInterpreter();
 | |
| 	PyRun_SimpleString(cmd);
 | |
| 	Py_Finalize();
 | |
| 
 | |
| 	return 0;
 | |
| }
 |