[Python-Dev] Symbolic errno values in error messages (original) (raw)
Yannick Gingras ygingras at ygingras.net
Fri May 16 12:52:35 CEST 2008
- Previous message: [Python-Dev] [Python-3000] PEP 3138- String representation in Python 3000
- Next message: [Python-Dev] Symbolic errno values in error messages
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, I spent some time googleing for "OSError 4" before it occurred to me that "4" was actually an irrelevant implementation detail. As soon as I searched for "EINTR", I found exactly what I was looking for. (not really but this is another story)
I jumped to the conclusion that OSError.str() should return the symbolic error number instead of the integer value. I was about to write a patch but I just noticed that OSError and friends are implemented in C so I guess it will be a bit harder than expected.
The error message comes from EnvironmentError.str() which is implemented by EnvironmentError_str() in Objects/exceptions.c. A Python implementation could have replaced self.errno in the format string args by errno.errorcode[self.errno]. However, it's not clear to me if there is such a mapping available in C.
Since my fix is not as trivial as I expected, I ask for advice regarding the following questions:
Should OSError.str() print the symbolic name of errno?
Where can I find the symbolic name in C?
Best regards,
-- Yannick Gingras
- Previous message: [Python-Dev] [Python-3000] PEP 3138- String representation in Python 3000
- Next message: [Python-Dev] Symbolic errno values in error messages
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]