summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2019-11-26 06:18:06 +0100
committerGeorg Brandl <georg@python.org>2019-11-26 06:18:06 +0100
commit57c15c02d84830cf5e704fd47ffa78429e8f5c4e (patch)
treef5ae63b6779c75da4e1c1fe380996da50955a5bf
parenta64aaa396f15bb6215bf6bef8e514ed493aecf05 (diff)
downloadpygments-git-57c15c02d84830cf5e704fd47ffa78429e8f5c4e.tar.gz
Python: make "python" shebang match Python 3
-rw-r--r--pygments/lexers/python.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/pygments/lexers/python.py b/pygments/lexers/python.py
index 970ea442..8b12216e 100644
--- a/pygments/lexers/python.py
+++ b/pygments/lexers/python.py
@@ -243,7 +243,7 @@ class Python2Lexer(RegexLexer):
}
def analyse_text(text):
- return shebang_matches(text, r'pythonw?(2(\.\d)?)?') or \
+ return shebang_matches(text, r'pythonw?2(\.\d)?') or \
'import ' in text[:1000]
@@ -429,7 +429,7 @@ class PythonLexer(RegexLexer):
tokens['strings-double'] = innerstring_rules(String.Double)
def analyse_text(text):
- return shebang_matches(text, r'pythonw?3(\.\d)?')
+ return shebang_matches(text, r'pythonw?(3(\.\d)?)?')
Python3Lexer = PythonLexer