[Patches] [ python-Patches-423759 ] fix on Python bugs 422678 and 423728

noreply@sourceforge.net noreply@sourceforge.net
Sun, 13 May 2001 13:53:19 -0700


Patches item #423759, was updated on 2001-05-13 12:18
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=423759&group_id=5470

Category: core (C code)
Group: None
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: Frederic Giacometti (giacometti)
Assigned to: Guido van Rossum (gvanrossum)
Summary: fix on Python bugs 422678 and 423728

Initial Comment:

This patch simply suppresses the assignment 'argv[_PyOS_optind] = "-c";'

This patch will be required for running JPE (the Java-Python Extension), starting from beta 2 
release.

Effects:

a)
python -c "import sys; print sys.argv" a b c
  will print
[ 'import sys; print sys.argv', 'a', 'b', 'c']

(note: 'import sys; print sys.argv' is a valid Unix/Windows/Macintosh file name.

b) argv[] is not modified unduely, and JPE's Java python.PyRun.main() method will not crash.

This patch should have no other technical effect.

FG

----------------------

*** Modules/main.c~	Tue Apr 10 18:07:08 2001
--- Modules/main.c	Sun May 13 14:54:02 2001
***************
*** 281,289 ****
  	
  	
  	if (command != NULL) {
! 		/* Backup _PyOS_optind and force sys.argv[0] = '-c' */
  		_PyOS_optind--;
- 		argv[_PyOS_optind] = "-c";
  	}
  
  	PySys_SetArgv(argc-_PyOS_optind, argv+_PyOS_optind);
--- 281,288 ----
  	
  	
  	if (command != NULL) {
! 		/* Backup _PyOS_optind */
  		_PyOS_optind--;
  	}
  
  	PySys_SetArgv(argc-_PyOS_optind, argv+_PyOS_optind);


----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-05-13 13:53

Message:
Logged In: YES 
user_id=6380

Ten years ago when I though what argv[0] should be when the
-c option was used, I considered all the possibilities, and
decided that '-c' made the most sense. It still does. So I'm
against changing this behavior.


----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-05-13 13:34

Message:
Logged In: YES 
user_id=31435

Changed Category, assigned to Guido.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=423759&group_id=5470