errno 22 instead of errno 2

Tim Golden mail at timgolden.me.uk
Wed Jan 28 10:04:30 CET 2009


Glenn Linderman wrote:
> open("c:\abc","rb")
> 
> This simple one-line script, produces errno 22 on Python 2.6, but errno 
> 2 on Python 2.5.2
> 
> Is this an unintentional regression?  Or is this an intentional bug fix?
> 
> The file doesn't exist (errno 2) but I guess on Windows it is also 
> somewhat an invalid file name (errno 22).
> 
> Yes, I'm aware that \a is ASCII 007.  Using a valid, non-existent file 
> name produces errno 2 on both versions.
> 


Just glancing quickly at the svn logs, there certainly were some
changes around that area in 2008:

http://svn.python.org/view/python/trunk/Objects/fileobject.c?view=log

Have a look at r61468, for example. Don't know if that's caused
what you're seeing but it might well be. (Don't have time just
at the mo to check out the revision and rebuild).

http://svn.python.org/view/python/trunk/Objects/fileobject.c?rev=61468&r1=60984&r2=61468


I'd question whether it's strictly a "regression", unintentional or
otherwise, since I doubt the code makes any particular commitment as
to which error code is raised, but I'd certainly be looking askance
if I had code which relied on a particular error number which then
changed!  Still, that's what unit tests are for, I suppose.

TJG



More information about the Python-list mailing list