mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 19:34:08 +00:00 
			
		
		
		
	Make the -m switch conform to the documentation of sys.path by behaving like the -c switch
This commit is contained in:
		
							parent
							
								
									f0d02fbb9a
								
							
						
					
					
						commit
						81f444bb8e
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -462,9 +462,10 @@ Py_Main(int argc, char **argv)
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	if (module != NULL) {
 | 
			
		||||
		/* Backup _PyOS_optind and force sys.arv[0] = module */
 | 
			
		||||
		/* Backup _PyOS_optind and force sys.argv[0] = '-c'
 | 
			
		||||
		   so that PySys_SetArgv correctly sets sys.path[0] to ''*/
 | 
			
		||||
		_PyOS_optind--;
 | 
			
		||||
        argv[_PyOS_optind] = module;
 | 
			
		||||
		argv[_PyOS_optind] = "-c";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	PySys_SetArgv(argc-_PyOS_optind, argv+_PyOS_optind);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue