From ba3a0b6c480f40f33736ce5734eabc0a8216255e Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 16 Aug 2016 02:19:15 +0100 Subject: [PATCH] Fix line numbers. --- econtext/master.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/econtext/master.py b/econtext/master.py index 89de709c..076a41b8 100644 --- a/econtext/master.py +++ b/econtext/master.py @@ -25,7 +25,7 @@ IOLOG = logging.getLogger('econtext.io') RLOG = logging.getLogger('econtext.ctx') DOCSTRING_RE = re.compile(r'""".+?"""', re.M | re.S) -COMMENT_RE = re.compile(r'^\s*#.*$', re.M) +COMMENT_RE = re.compile(r'^[ \t]*#[^\n]*$', re.M) def minimize_source(source): @@ -33,7 +33,7 @@ def minimize_source(source): numbers and syntax of empty blocks.""" subber = lambda match: '""' + ('\n' * match.group(0).count('\n')) source = DOCSTRING_RE.sub(subber, source) - source = COMMENT_RE.sub('\n', source) + source = COMMENT_RE.sub('', source) return source.replace(' ', '\t')