msg203035 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2013-11-16 12:21 |
It will be good to switch constants in the errno module to IntEnum. |
|
|
msg204394 - (view) |
Author: Chris (chrishood) |
Date: 2013-11-25 20:16 |
I would be interested in tackling this as a first patch, can you give me some more information? |
|
|
msg204395 - (view) |
Author: Ethan Furman (ethan.furman) *  |
Date: 2013-11-25 20:24 |
Check out socket.py for an example of constants being changed over to IntEnum. Feel free to ask more questions! :) |
|
|
msg204398 - (view) |
Author: Ethan Furman (ethan.furman) *  |
Date: 2013-11-25 20:26 |
Also see Issue18720 for those details. |
|
|
msg204400 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2013-11-25 20:28 |
This is not so easy issue because the errno module is not pure Python module. ;) |
|
|
msg204409 - (view) |
Author: Chris (chrishood) |
Date: 2013-11-25 21:19 |
I think I'll look for some other issues, this one looks a bit deep for a first patch. |
|
|
msg204482 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2013-11-26 15:07 |
I don't know if it's possible/convinient, but it would be nice to have a str() method using os.strerror(). Or maybe a method with a different name. |
|
|
msg204493 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2013-11-26 15:45 |
> This is not so easy issue because the errno module is not pure Python module. ;) An option is to rename the C errno module to _errno and leave it unchanged, and provide a Python errno module which enum API. Then slowly errno module should be used instead of _errno. Using enum for errno should not slow down Python startup time. |
|
|
msg204662 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2013-11-28 14:39 |
> An option is to rename the C errno module to _errno and leave it > unchanged, and provide a Python errno module which enum API. I agree it sounds reasonable. > Using enum for errno should not slow down Python startup time. enum imports OrderedDict from collections, which imports other modules... |
|
|
msg204663 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2013-11-28 14:40 |
Note that even if errno is migrated to enum, OSErrors raised by the interpreter will still have a raw int errno... |
|
|
msg204666 - (view) |
Author: Marc-Andre Lemburg (lemburg) *  |
Date: 2013-11-28 14:48 |
I'm not sure whether changing the errno module to use enums would be conceptually correct: enums declare a fixed set of permitted values, but errno values can be any integer, are platform dependent and are sometimes not unique (e.g. EWOULDBLOCK = EAGAIN, or the various Windows WSA errno values which map to similar integers as the Unix ones). |
|
|