Lawouach / WebSocket-for-Python

WebSocket client and server library for Python 2 and 3 as well as PyPy (ws4py 0.5.1)
https://ws4py.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
1.12k stars 288 forks source link

Removed unnecessary try/except and cleaned for some PEP8 #155

Closed warvariuc closed 9 years ago

Lawouach commented 9 years ago

Hello,

I'm not quite sure it was a useless try/except clause. As it stands, in your code the ws object may never removed from the pool. Is that expected?

warvariuc commented 9 years ago

I don't quite understand what you mean. These lines

if ws:
    self.server.pool.track(ws)

will be reached in the old and new implementations only if there were no exceptions in the first 3 lines, because of this:

except:
   raise
Lawouach commented 9 years ago

Damn. I somehow read finally rather than else on the try/except. You are right.

warvariuc commented 9 years ago

Maybe there should be some logic using finally but I am not aware of it.

Lawouach commented 9 years ago

I think I need to spend some time trying to identify the key issues with error handlings and related cleanups.