errno 22 instead of errno 2

Tim Golden mail at
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:

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).

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.


More information about the Python-list mailing list