Skip to content

Commit 368c8e2

Browse files
committed
Fix py3k
Enable syntax errors to properly surface invalid code in py3 porting mode, instead of silently swallowing them and giving the incorrect impression that the code is valid for py3. Closes #2956
1 parent 97f4f2a commit 368c8e2

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

CONTRIBUTORS.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,3 +340,6 @@ contributors:
340340
* laike9m: contributor
341341

342342
* Janne Rönkkö: contributor
343+
344+
* Hugues Bruant: contributor
345+

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ Release date: TBA
3333

3434
* Allow parallel linting when run under Prospector
3535

36+
* Python 3 porting mode no longer swallows syntax errors
37+
38+
Closes #2956
39+
3640

3741
What's New in Pylint 2.4.3?
3842
===========================

pylint/lint.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,11 @@ def error_mode(self):
748748
def python3_porting_mode(self):
749749
"""Disable all other checkers and enable Python 3 warnings."""
750750
self.disable("all")
751+
# re-enable some errors, or 'print', 'raise', 'async', 'await' will mistakenly lint fine
752+
self.enable("F0001")
753+
self.enable("F0002")
754+
self.enable("F0010")
755+
self.enable("E0001")
751756
self.enable("python3")
752757
if self._error_mode:
753758
# The error mode was activated, using the -E flag.

0 commit comments

Comments
 (0)