[Python-checkins] python/dist/src/Python sysmodule.c,2.111,2.112

theller@users.sourceforge.net theller@users.sourceforge.net
Wed, 08 Jan 2003 06:33:51 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1:/tmp/cvs-serv12807

Modified Files:
	sysmodule.c 
Log Message:
Patch #664376: sys.path[0] should contain absolute pathname.

This fixes the problem on Windows - that's the only system where I can
test it.

It leaves sys.argv alone and only changes sys.path[0] to an absolute
pathname.


Index: sysmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v
retrieving revision 2.111
retrieving revision 2.112
diff -C2 -d -r2.111 -r2.112
*** sysmodule.c	8 Oct 2002 02:44:28 -0000	2.111
--- sysmodule.c	8 Jan 2003 14:33:48 -0000	2.112
***************
*** 970,973 ****
--- 970,976 ----
  PySys_SetArgv(int argc, char **argv)
  {
+ #ifdef MS_WINDOWS
+ 	char fullpath[MAX_PATH];
+ #endif
  	PyObject *av = makeargvobject(argc, argv);
  	PyObject *path = PySys_GetObject("path");
***************
*** 1012,1015 ****
--- 1015,1027 ----
  		if (argc > 0 && argv0 != NULL) {
  			char *q;
+ #ifdef MS_WINDOWS
+ 			char *ptemp;
+ 			if (GetFullPathName(argv0,
+ 					   sizeof(fullpath),
+ 					   fullpath,
+ 					   &ptemp)) {
+ 				argv0 = fullpath;
+ 			}
+ #endif
  			p = strrchr(argv0, SEP);
  			/* Test for alternate separator */