Open sslupsky opened 1 week ago
thanks, i got them in the CI as well
test_parse_unix_schemes (test.test_client.BasicClientTest) ... /home/runner/work/WebSocket-for-Python/WebSocket-for-Python/test/test_client.py:37: ResourceWarning: unclosed
ok test_thread_is_started_once_connected_secure (test.test_client.ThreadedClientTest) Same as the above test, but with SSL socket ... Exception in thread WebSocketClient: Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/home/runner/work/WebSocket-for-Python/WebSocket-for-Python/ws4py/websocket.py", line 528, in run if not self.once(): File "/home/runner/work/WebSocket-for-Python/WebSocket-for-Python/ws4py/websocket.py", line 410, in once if not self.process(self.buf[:requested]): File "/home/runner/work/WebSocket-for-Python/WebSocket-for-Python/ws4py/websocket.py", line 465, in process logger.debug("Closing message received (%d): %s" % (s.closing.code, s.closing.reason.decode() if isinstance(s.closing.reason, bytes) else s.closing.reason)) TypeError: isinstance() arg 2 must be a type or tuple of types
I wonder why bytes
is not recognized as a type.
Maybe it's overridden by some local variable?
The second parameter is null.
This should not cause any problems by itself.
I think the problem is that when process() is called at line 410, it makes the call without including the second parameter, namely bytes and the definition of process() does not define the default argument. So, there is no "bytes" object (it is None).
The problem is process()
second argument is named bytes
, which is Python name for built-in type.
Of course, isinstance(anything, bytes)
would fail in this situation, because bytes
is not a type.
To fix this problem, the process()
argument should be renamed to something more reasonable, like data
.
It looks like this issue is fixed and can be closed now.
Recent commit appears to be causing a TypeError: https://github.com/Lawouach/WebSocket-for-Python/commit/cb60792322c55e22896ff8955b220641895dad46
Here is the error:
See also: https://github.com/klattimer/LGWebOSRemote/issues/172
Seems like the error might be from this line: https://github.com/Lawouach/WebSocket-for-Python/blob/cb60792322c55e22896ff8955b220641895dad46/ws4py/websocket.py#L410
The second parameter is null.