diff -r dc171b1d8261 -r 362cd1b6f81a eric6/DebugClients/Python/coverage/phystokens.py --- a/eric6/DebugClients/Python/coverage/phystokens.py Wed Feb 19 19:38:36 2020 +0100 +++ b/eric6/DebugClients/Python/coverage/phystokens.py Sat Feb 22 14:27:42 2020 +0100 @@ -1,5 +1,5 @@ # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 -# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt +# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt """Better tokenizing for coverage.py.""" @@ -27,7 +27,7 @@ """ last_line = None last_lineno = -1 - last_ttype = None + last_ttext = None for ttype, ttext, (slineno, scol), (elineno, ecol), ltext in toks: if last_lineno != elineno: if last_line and last_line.endswith("\\\n"): @@ -47,9 +47,7 @@ # so we need to figure out if the backslash is already in the # string token or not. inject_backslash = True - if last_ttype == tokenize.COMMENT: - # Comments like this \ - # should never result in a new token. + if last_ttext.endswith("\\"): inject_backslash = False elif ttype == token.STRING: if "\n" in ttext and ttext.split('\n', 1)[0][-1] == '\\': @@ -66,7 +64,8 @@ last_line ) last_line = ltext - last_ttype = ttype + if ttype not in (tokenize.NEWLINE, tokenize.NL): + last_ttext = ttext yield ttype, ttext, (slineno, scol), (elineno, ecol), ltext last_lineno = elineno