From 508e81eda0fea2d8c8679d21887ee08c94da8eaa Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 8 Feb 2005 15:39:11 +0000 Subject: [PATCH] Convert splitlines to for-loop (handles case where input does not have a trailing newline). --- Lib/rfc822.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/rfc822.py b/Lib/rfc822.py index 4448e7d542..871a049c21 100644 --- a/Lib/rfc822.py +++ b/Lib/rfc822.py @@ -393,8 +393,8 @@ class Message: del self[name] # Won't fail if it doesn't exist self.dict[name.lower()] = value text = name + ": " + value - self.headers.extend(text.splitlines(True)) - self.headers.append('\n') + for line in text.split("\n"): + self.headers.append(line + "\n") def __delitem__(self, name): """Delete all occurrences of a specific header, if it is present.""" @@ -423,8 +423,8 @@ class Message: return self.dict[lowername] else: text = name + ": " + default - self.headers.extend(text.splitlines(True)) - self.headers.append('\n') + for line in text.split("\n"): + self.headers.append(line + "\n") self.dict[lowername] = default return default -- 2.49.0