From e48402d7a522bfe8647c58ebe09613b36c7c7066 Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Mon, 21 Sep 2015 20:12:11 +0300 Subject: [PATCH] Fix report of line number and Unicode exception on redundant transformation --- src/mapcss/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mapcss/__init__.py b/src/mapcss/__init__.py index a7aea62..9efbff8 100644 --- a/src/mapcss/__init__.py +++ b/src/mapcss/__init__.py @@ -318,6 +318,8 @@ class MapCSS(): else: raise Exception("Unexpected construction: " + css) + stck[-1][1] = css # store remained part + if not wasBroken: stck.pop() @@ -329,7 +331,7 @@ class MapCSS(): filename = stck[-1][0] # filename css_orig = stck[-1][2] # original css = stck[-1][1] # remained - line = unicode(css_orig[:-len(unicode(css))]).count("\n") + 1 + line = css_orig[:-len(css)].count("\n") + 1 msg = str(e) + "\nFile: " + filename + "\nLine: " + str(line) raise Exception(msg)