Fix TypeError in socket.error exception handling#160
Fix TypeError in socket.error exception handling#160vasily-v-ryabov merged 1 commit intopython-xlib:masterfrom
Conversation
The socket.error, which is an alias to OSError since python 3.3, is not subscriptable (and its subclasses neither are). Hence, pass the entire exception message to close_internal(). In case of a socket.error in self.socket.send(), the former crashed with a TypeError. I strongly suspect that this closes issue python-xlib#127.
Codecov Report
@@ Coverage Diff @@
## master #160 +/- ##
==========================================
- Coverage 81.96% 81.94% -0.03%
==========================================
Files 41 41
Lines 4801 4801
==========================================
- Hits 3935 3934 -1
- Misses 866 867 +1 |
|
I'm experiencing this TypeError, because in the testsuite for my project herbstluftwm, a |
While python-xlib/python-xlib#160 is not merged, try to avoid issue #609 by attempting to open the display multiple times as long as no TypeError occurs anymore.
While python-xlib/python-xlib#160 is not merged, try to avoid issue #609 by attempting to open the display multiple times as long as no TypeError occurs anymore.
|
How about proper handling it for Python 2.7? |
Shouldn't this also work for Python 2.7? As long as |
|
It's just an assumption. Could you please confirm it's tested and works under Py2.7 ? |
|
I don't know how to reproduce this, since it's in the exception handler of quite a low-level exception. All I can do is looking up the documentation of
So it's even unclear to me whether |
|
Well, I've checked synthetic case and similar construction works in Python 2.7. Merging... |
|
Thanks for taking care of it and for merging! I wasn't really sure how to properly test it! |
The socket.error, which is an alias to OSError since python 3.3, is not
subscriptable (and its subclasses neither are). Hence, pass the entire
exception message to close_internal().
In case of a socket.error in self.socket.send(), the former code crashed
with a TypeError.
I strongly suspect that this closes issue #127.