[Python-Dev] Symbolic errno values in error messages (original) (raw)

Yannick Gingras ygingras at ygingras.net
Mon May 19 15:04:25 CEST 2008


"Alexandre Vassalotti" <alexandre at peadrop.com> writes:

So now I am not sure what OP is proposing. Do you want to replace 21 with EISDIR in the above?

Yes, that's what I had in mind. Then, check out EnvironmentErrorstr in Objects/exceptions.c. You should be able import the errno module and fetch its errorcode dictionary.

It wasn't as hard as I expected. It's the first time that I play with the Python C API; I didn't expect the API to be that high level.

I attached a patch to convert errno to its symbolic value when an EnvironmentError is printed. Should attach it to a ticket on bugs.python.org?

I'm sure there is a style guide like PEP-8 for C code, feel free to point me to it because my patch is probably not fully style compliant.

With Emacs, doing

M-x c-set-style python

doesn't seems to do the right thing. Are you all using a bunch of shared settings in you .emacs files?

-- Yannick Gingras -------------- next part -------------- A non-text attachment was scrubbed... Name: python-26-sympolic-errno.diff Type: text/x-diff Size: 2288 bytes Desc: not available URL: <http://mail.python.org/pipermail/python-dev/attachments/20080519/77cf73ca/attachment-0001.diff>



More information about the Python-Dev mailing list