[Patches] [ python-Patches-448227 ] execfile(dir) no longer works

noreply@sourceforge.net noreply@sourceforge.net
Sun, 05 Aug 2001 15:24:48 -0700


Patches item #448227, was opened at 2001-08-05 13:05
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=448227&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 2
Submitted By: Titus Brown (titus)
Assigned to: Nobody/Anonymous (nobody)
Summary: execfile(dir) no longer works

Initial Comment:
'execfile(".")' succeeds w/o an error in the current
implementation.  I'm not sure why the _parse itself_
succeeds, but because a directory can be opened by
fopen() for reading, the check in execfile itself
succeeds.

I added in a check (via stat()) to see if the filename
given is a directory.  If it is, execfile raises an
IOError (same as for filename not existing).  I'm
perfectly willing to admit that this may not be the
best solution ;), but it's less nonintuitive than the
current behavior.



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

>Comment By: Titus Brown (titus)
Date: 2001-08-05 15:24

Message:
Logged In: YES 
user_id=23486

Section 3.1 of the FAQ:

If you are using CVS (anonymous or developer) you can use
CVS to make the patches for you. Just edit your local copy
and enter the following command:

cvs diff | tee ~/name_of_the_patch.diff

So that should be 'cvs diff -c | ...' ;).


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

Comment By: Tim Peters (tim_one)
Date: 2001-08-05 15:15

Message:
Logged In: YES 
user_id=31435

The Python @ SF FAQ already says:

"""
We like context diffs. We grudgingly accept unified diffs. 
Straight ("ed-style") diffs are right out! If you don't 
know how to generate context diffs, you're probably not 
qualified to produce high-quality patches anyway <0.5 
wink>. 
"""

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

Comment By: Titus Brown (titus)
Date: 2001-08-05 14:54

Message:
Logged In: YES 
user_id=23486

errno is now correctly set to EISDIR.  I've also modified it
a bit more so it doesn't try to fopen it if the stat fails,
since I can think of no situation in which stat fails & an
fopen will succeed.

New context (-c) diff attached.

N.B. that the Python @ Sourceforge FAQ should be modified to
reflect the desire for -c or -u diffs ;).


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

Comment By: Martin v. Löwis (loewis)
Date: 2001-08-05 14:15

Message:
Logged In: YES 
user_id=21627

Can you please submit unified (-u) or context (-c) diffs 
in the future? Plain diffs, without context, are hard to 
integrated once the underlying file changes.

As for the IOError, I think you should make sure you get a 
specific errno code, e.g. EISDIR. Would you be willing to 
revise your patch in that direction?


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

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