Browse Source

When empty array or dictionary were passed for data, an uncatched TypeError exception was raised.

pull/5/head
david 10 years ago
parent
commit
698c3dc7e6
  1. 8
      socketio/packet.py

8
socketio/packet.py

@ -135,8 +135,14 @@ class Packet(object):
else: else:
return data return data
def _data_is_binary(self, data): def _data_is_binary(self, data):
"""Check if the data contains binary components.""" """Check if the data contains binary components."""
try:
if isinstance(data, six.binary_type): if isinstance(data, six.binary_type):
return True return True
elif isinstance(data, list): elif isinstance(data, list):
@ -149,3 +155,5 @@ class Packet(object):
for item in six.itervalues(data)]) for item in six.itervalues(data)])
else: else:
return False return False
except TypeError:
return False

Loading…
Cancel
Save