[Patches] [ python-Patches-664376 ] sys.path[0] should contain absolute pathname

SourceForge.net noreply@sourceforge.net
Fri, 10 Jan 2003 14:15:08 -0800


Patches item #664376, was opened at 2003-01-08 07:26
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=664376&group_id=5470

Category: None
Group: None
Status: Open
Resolution: Accepted
Priority: 5
Submitted By: Thomas Heller (theller)
Assigned to: Nobody/Anonymous (nobody)
Summary: sys.path[0] should contain absolute pathname

Initial Comment:
This patch changes sys.path[0] to contain an absolute 
instead of a relative pathname.

See python-dev thread starting here:
http://mail.python.org/pipermail/python-dev/2003-
January/031896.html

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

>Comment By: Skip Montanaro (montanaro)
Date: 2003-01-10 16:15

Message:
Logged In: YES 
user_id=44345

Regarding the includes, I was just going by the realpath manpage on 
my Mac and the fact that a quick scan of Include/*.h didn't turn them up.
S

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2003-01-10 15:58

Message:
Logged In: YES 
user_id=6380

The abspath.diff patch seems to work.

But the two new includes in sysmodule.c are not needed AFAICT.

Check in time!

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

Comment By: Skip Montanaro (montanaro)
Date: 2003-01-10 15:32

Message:
Logged In: YES 
user_id=44345

Here's a somewhat different patch.  I don't know if the actual sysmodule.c
patch is correct or not, but it includes the necessary framework to
verify that realpath() is available.  Pick and choose bits as you like.

Skip

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

Comment By: Thomas Heller (theller)
Date: 2003-01-10 08:24

Message:
Logged In: YES 
user_id=11105

I believe this problem should be fixed also on systems other
than Windows, or the checkin should be reverted again.

I've prepared a patch based on an idea of Skip Montanaro,
who pointed my to the realpath() function.
It is tested on a SuSE 7.0 Linux system, but I don't know
which #ifdef I have to se around this code. See the patch
for details.

Reopened and unassigned for review.

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

Comment By: Thomas Heller (theller)
Date: 2003-01-08 09:02

Message:
Logged In: YES 
user_id=11105

Checked in as sysmodule.c, rev 2.112.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2003-01-08 08:00

Message:
Logged In: YES 
user_id=6380

Feel free to check this in.

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

Comment By: Thomas Heller (theller)
Date: 2003-01-08 07:31

Message:
Logged In: YES 
user_id=11105

The attached patch (sysmodule.diff) 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.


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

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