From a7ab7fc0568143118acfccde4f40469db62fd4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Cavaill=C3=A9?= Date: Thu, 15 Jan 2015 02:36:32 +0100 Subject: [PATCH] Use unicode() instead of decode() for perfs --- aggregator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aggregator.py b/aggregator.py index a0017e272a..cf628d3517 100644 --- a/aggregator.py +++ b/aggregator.py @@ -503,8 +503,8 @@ def submit_packets(self, packets): # network socket, but if submit_packets is used # programatically and packets is unicode already # then do not decode! - if not isinstance(packets, unicode): - packets = packets.decode('utf-8', 'replace') + if not type(packets) == unicode: + packets = unicode(packets, 'utf-8') for packet in packets.splitlines():