From 392817432bdc16cffc3bc725b208253aed68dfc3 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 4 Sep 2026 12:23:07 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6?= =?UTF-8?q?=D0=B0=D1=82=D1=8C=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9?= =?UTF-8?q?=D0=BA=D0=B8=20=D1=82=D1=80=D0=B5=D0=BD=D0=B4=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B2=20Python=203.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/protocan/trends.py | 3 ++- python/tests/test_plot.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/python/protocan/trends.py b/python/protocan/trends.py index 22e2daa..e047e1b 100644 --- a/python/protocan/trends.py +++ b/python/protocan/trends.py @@ -129,7 +129,8 @@ def encode_settings(settings: Mapping[str, list[TrendSignal]]) -> str: def decode_settings(text: str) -> dict[str, list[TrendSignal]]: if len(text.encode("utf-8")) > MAX_FILE_BYTES: raise ValueError("Trend configuration exceeds 1 MiB") - root = json.loads(text.removeprefix("\ufeff")) + # Python 3.8 is used by the Windows 7 port; remove at most one BOM. + root = json.loads(text[1:] if text.startswith("\ufeff") else text) if not isinstance(root, dict) or root.get("format") != "setflash-trends" or type(root.get("version")) is not int or root["version"] != 1: raise ValueError("Unknown trend configuration format/version") profiles = root.get("profiles") diff --git a/python/tests/test_plot.py b/python/tests/test_plot.py index b229824..4470200 100644 --- a/python/tests/test_plot.py +++ b/python/tests/test_plot.py @@ -9,6 +9,7 @@ import unittest from protocan.plot import Bounds, Marker, Markers, PlotMath, Viewport +@unittest.skipUnless(os.environ.get("SETPROTOCOL_LIBRARY"), "Set SETPROTOCOL_LIBRARY to the built C library") class PlotTests(unittest.TestCase): @classmethod def setUpClass(cls):