From 5251bf23f1b59f9e75a58651bee3ac1989b910f4 Mon Sep 17 00:00:00 2001
From: Kevin O'Connor <kevin@koconnor.net>
Date: Fri, 8 Oct 2021 00:23:31 -0400
Subject: [PATCH] configfile: Workaround for non-ascii comments on Python2

Explicitly specify the comment_prefixes as regular Python2 strings -
otherwise the configparser wont ignore non-ascii characters in
comments.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
---
 klippy/configfile.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/klippy/configfile.py b/klippy/configfile.py
index 55aed295b..518b574b7 100644
--- a/klippy/configfile.py
+++ b/klippy/configfile.py
@@ -255,8 +255,9 @@ class PrinterConfig:
         self._parse_config_buffer(buffer, filename, fileconfig)
         visited.remove(path)
     def _build_config_wrapper(self, data, filename):
+        cp = (';', '#')
         fileconfig = configparser.RawConfigParser(
-            strict=False, inline_comment_prefixes=(';','#'))
+            strict=False, comment_prefixes=cp, inline_comment_prefixes=cp)
         self._parse_config(data, filename, fileconfig, set())
         return ConfigWrapper(self.printer, fileconfig, {}, 'printer')
     def _build_config_string(self, config):