Title: telnetlib AttributeError: 'error' object has no attribute 'errno' (handling of select.error)
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
Status: closed Resolution: duplicate
Dependencies: Superseder: telnetlib incorrectly assumes that select.error has an errno attribute
View: 18035
Assigned To: Nosy List: Muhammad Toufeeq Ockards, berker.peksag, gregory.p.smith, xiang.zhang
Priority: normal Keywords:

Created on 2016-06-07 08:24 by Muhammad Toufeeq Ockards, last changed 2016-06-07 12:22 by berker.peksag. This issue is now closed.

Messages (3)
msg267603 - (view) Author: Muhammad Toufeeq Ockards (Muhammad Toufeeq Ockards) Date: 2016-06-07 08:24
I was using the telnetlib on linux in python 2.7 and ran into error that executed line 320 of 

319: except select.error as e:
320:    if e.errno == errno.EINTR:

Inspecting select.error showed that it has no errno attribute.

I opened up a python2.7 idle session on my computer and entered the following. 

>>> import select
>>> try:
...     raise select.error
... except Exception as e:
...     pass
>>> e
>>> dir(e)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__getitem__', '__getslice__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__unicode__', '__weakref__', 'args', 'message']
>>> e.errno
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'error' object has no attribute 'errno'
msg267604 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-06-07 09:05
In py2, select.error is a stand alone exception while in py3 it's an alias of OSError. This difference seems not noticed when introduced in 872afada51b0.
msg267647 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-06-07 12:22
Thanks for the report. This is a duplicate of issue 18035.
Date User Action Args
2016-06-07 12:22:07berker.peksagsetstatus: open -> closed

superseder: telnetlib incorrectly assumes that select.error has an errno attribute

nosy: + berker.peksag
messages: + msg267647
resolution: duplicate
stage: resolved
2016-06-07 09:05:35xiang.zhangsetnosy: + gregory.p.smith, xiang.zhang
messages: + msg267604
2016-06-07 08:24:36Muhammad Toufeeq Ockardscreate