From 792df283d97d38e99cc73132e7350a7f87c1cbd1 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 31 Oct 2016 11:27:49 -0400 Subject: [PATCH] Fix "invalid escape sequence" bytestring warnings in Python 3.6 --- PIL/GimpPaletteFile.py | 2 +- PIL/PngImagePlugin.py | 2 +- PIL/XbmImagePlugin.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PIL/GimpPaletteFile.py b/PIL/GimpPaletteFile.py index 4bf3ca36a..e4b4641e5 100644 --- a/PIL/GimpPaletteFile.py +++ b/PIL/GimpPaletteFile.py @@ -41,7 +41,7 @@ class GimpPaletteFile(object): if not s: break # skip fields and comment lines - if re.match(b"\w+:|#", s): + if re.match(br"\w+:|#", s): continue if len(s) > 100: raise SyntaxError("bad palette file") diff --git a/PIL/PngImagePlugin.py b/PIL/PngImagePlugin.py index a5f4c3f42..4d6f9d7ff 100644 --- a/PIL/PngImagePlugin.py +++ b/PIL/PngImagePlugin.py @@ -48,7 +48,7 @@ i8 = _binary.i8 i16 = _binary.i16be i32 = _binary.i32be -is_cid = re.compile(b"\w\w\w\w").match +is_cid = re.compile(br"\w\w\w\w").match _MAGIC = b"\211PNG\r\n\032\n" diff --git a/PIL/XbmImagePlugin.py b/PIL/XbmImagePlugin.py index bca882866..d0b0e47ab 100644 --- a/PIL/XbmImagePlugin.py +++ b/PIL/XbmImagePlugin.py @@ -26,7 +26,7 @@ __version__ = "0.6" # XBM header xbm_head = re.compile( - b"\s*#define[ \t]+.*_width[ \t]+(?P[0-9]+)[\r\n]+" + br"\s*#define[ \t]+.*_width[ \t]+(?P[0-9]+)[\r\n]+" b"#define[ \t]+.*_height[ \t]+(?P[0-9]+)[\r\n]+" b"(?P" b"#define[ \t]+[^_]*_x_hot[ \t]+(?P[0-9]+)[\r\n]+"