Skip to content

Commit 4b80923

Browse files
committed
correctly handle bytearray with extend or append
1 parent dd4a464 commit 4b80923

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

AWSIoTPythonSDK/core/greengrass/discovery/providers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,14 @@ def _receive_until(self, ssl_sock, criteria_function, extra_data=None):
366366
start_time = time.time()
367367
response = bytearray()
368368
number_bytes_read = 0
369+
ssl_sock_tmp = None
369370
while True: # Python does not have do-while
370371
try:
371-
response.extend(self._convert_to_int_py3(ssl_sock.read(1)))
372+
ssl_sock_tmp = self._convert_to_int_py3(ssl_sock.read(1))
373+
if ssl_sock_tmp is list:
374+
response.extend(ssl_sock_tmp)
375+
else:
376+
response.append(ssl_sock_tmp)
372377
number_bytes_read += 1
373378
except socket.error as err:
374379
if err.errno == ssl.SSL_ERROR_WANT_READ or err.errno == ssl.SSL_ERROR_WANT_WRITE:

0 commit comments

Comments
 (0)