[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-bugs-list
Subject:    [issue2920] Patch to print symbolic value of errno in OSError.__str__()
From:       Eryk Sun <report () bugs ! python ! org>
Date:       2019-07-31 18:33:42
Message-ID: 1564598022.81.0.780149341957.issue2920 () roundup ! psfhosted ! org
[Download RAW message or body]


Eryk Sun <eryksun@gmail.com> added the comment:

How about doing something similar for Windows when winerror is set? This is a common \
case since many os functions use the Windows API directly. Showing the symbolic error \
name will help to disambiguate exceptions, such as 

    FileNotFoundError (ENOENT) from:

        ERROR_FILE_NOT_FOUND
        ERROR_PATH_NOT_FOUND
        ERROR_FILENAME_EXCED_RANGE
        ERROR_BAD_PATHNAME
        ERROR_BAD_NET_NAME

    PermissionError (EACCES) from:

        ERROR_ACCESS_DENIED
        ERROR_SHARING_VIOLATION
        ERROR_LOCK_VIOLATION
        ERROR_NETWORK_ACCESS_DENIED
        ERROR_NOT_READY

It could also support additional error codes that are common or used internally, such \
as 

    ERROR_NOT_SUPPORTED
    ERROR_INVALID_NAME
    ERROR_MOD_NOT_FOUND
    ERROR_PRIVILEGE_NOT_HELD
    ERROR_CANT_RESOLVE_FILENAME
    ERROR_INVALID_REPARSE_DATA

Modules/_winapi.c:

    ERROR_NETNAME_DELETED
    ERROR_SEM_TIMEOUT
    ERROR_PIPE_BUSY
    ERROR_MORE_DATA
    ERROR_PIPE_CONNECTED
    ERROR_OPERATION_ABORTED
    ERROR_IO_PENDING
    ERROR_NO_SYSTEM_RESOURCES

----------
nosy: +ZackerySpytz, eryksun

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue2920>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-bugs-list%40marc.info



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic