summaryrefslogtreecommitdiff
path: root/coverage/phystokens.py
diff options
context:
space:
mode:
authorMax Linke <max_linke@gmx.de>2015-12-14 11:27:12 +0100
committerMax Linke <max_linke@gmx.de>2015-12-14 11:27:12 +0100
commitf7ca62f80d91f4f207a0b9f5675aa251be3dfff1 (patch)
tree6f7c8a09e444409a720fba463fabae2c45fe7452 /coverage/phystokens.py
parent795a3679f89ed98bb278daf075123d0b55fd091e (diff)
downloadpython-coveragepy-f7ca62f80d91f4f207a0b9f5675aa251be3dfff1.tar.gz
Fix error with double occurence of encoding declaration
If a file sets the encoding using both vim and emacs style we can't compile the source-code. This commit ensures that always both occurences are removed before we compile the source-code.
Diffstat (limited to 'coverage/phystokens.py')
-rw-r--r--coverage/phystokens.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/coverage/phystokens.py b/coverage/phystokens.py
index b34b1c3..5aa3402 100644
--- a/coverage/phystokens.py
+++ b/coverage/phystokens.py
@@ -291,5 +291,5 @@ def compile_unicode(source, filename, mode):
@contract(source='unicode', returns='unicode')
def neuter_encoding_declaration(source):
"""Return `source`, with any encoding declaration neutered."""
- source = COOKIE_RE.sub("# (deleted declaration)", source, count=1)
+ source = COOKIE_RE.sub("# (deleted declaration)", source, count=2)
return source