TypeError fix for unexpected NoneType in list

FIX: TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

Caused when the "finished" list is summed with the function "sum".
This commit is contained in:
E. Almqvist 2021-11-30 09:43:18 +01:00
parent 22210ca352
commit 10a4ccba0a
1 changed files with 2 additions and 1 deletions

View File

@ -1656,7 +1656,8 @@ class Speedtest(object):
while _is_alive(thread):
thread.join(timeout=0.001)
in_flight['threads'] -= 1
finished.append(thread.result)
if type(thread.result) in (int, float):
finished.append(thread.result)
callback(thread.i, request_count, end=True)
q = Queue(threads or self.config['threads']['upload'])