Opened 10 years ago

Last modified 10 years ago

#4605 task new

Change FileDescriptor.fileno to raise an exception instead of returning -1

Reported by: Jean-Paul Calderone Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author:

Description

Presumably FileDescriptor.fileno was written this way because Python sockets used to return -1 when they were closed. They don't anymore, though, and exceptions are a better way to signal an error anyway.

Change History (2)

comment:1 Changed 10 years ago by Glyph

I have some vague memories of this being a performance issue, as well - raising exceptions is expensive, and I remember some early benchmarks showing connection-closing as a hotspot if you have to raise an exception in order to close a connection it's bad. However, I think that if #4539 were fixed, it probably wouldn't matter, since really you should never be calling fileno on a bad file descriptor anyway.

This ticket should also have some kind of reference to #2825, although I'm not sure what the relationship is there.

comment:2 Changed 9 years ago by <automation>

Owner: Glyph deleted
Note: See TracTickets for help on using tickets.