iterate over args directly without indexing

Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
This commit is contained in:
fenn-cs 2021-10-19 23:57:52 +01:00
parent 1a12a8acdf
commit 20ad6cd9e7

View File

@ -335,12 +335,7 @@ def log_call_deferred(action_type):
kwargs = {k: bytes_to_unicode(True, kw[k]) for k in kw}
# Remove complex (unserializable) objects from positional args to
# prevent eliot from throwing errors when it attempts serialization
args = tuple(
a[pos]
if is_json_serializable(a[pos])
else str(a[pos])
for pos in range(len(a))
)
args = tuple(arg if is_json_serializable(arg) else str(arg) for arg in a)
with start_action(action_type=action_type, args=args, kwargs=kwargs).context():
# Use addActionFinish so that the action finishes when the
# Deferred fires.