This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sbt
Recipients pitrou, sbt
Date 2012-08-25.18:44:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1345920277.5.0.279969365859.issue15784@psf.upfronthosting.co.za>
In-reply-to
Content
Since WindowsError became an alias of OSError, the error number shown in the stringification of an OSError err can either be a windows error code (err.winerror) or a posix style error number (err.errno), with no way to tell which.

For instance in

  >>> os.read(999, 0)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  OSError: [Errno 9] Bad file descriptor

err.errno == EBADF == 9 and err.winerror == None, but in

  >>> _winapi.ReadFile(999, 0)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  OSError: [Error 6] The handle is invalid

err.errno == EBADF == 9 and err.winerror == ERROR_INVALID_HANDLE == 6.  (winerror gets priority over errno if it exists.)

With the attached patch the second will be shown as

  >>> _winapi.ReadFile(999, 0)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  OSError: [WinError 6] The handle is invalid
            ^^^

Since this issue only applies to 3.3 and the patch is trivial, it would be nice to get this in before 3.3 is released.
History
Date User Action Args
2012-08-25 18:44:37sbtsetrecipients: + sbt, pitrou
2012-08-25 18:44:37sbtsetmessageid: <1345920277.5.0.279969365859.issue15784@psf.upfronthosting.co.za>
2012-08-25 18:44:36sbtlinkissue15784 messages
2012-08-25 18:44:36sbtcreate