You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When AstroidSyntaxError is caught and a syntax-error is raised, an assertion fails when a line number is lacking.
I suppose we could either raise "fatal" instead or expand _SCOPE_EXEMPT to also include syntax-error.
Configuration
No response
Command used
python3 -m pylint coverage.tracer
Pylint output
Traceback (most recent call last):
File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tokenize.py", line 330, in find_cookie
line_string = line.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 0: invalid continuation byteDuring handling of the above exception, another exception occurred:Traceback (most recent call last): File "/opt/homebrew/lib/python3.9/site-packages/astroid/builder.py", line 105, in file_build stream, encoding, data = open_source_file(path) File "/opt/homebrew/lib/python3.9/site-packages/astroid/builder.py", line 40, in open_source_file encoding = detect_encoding(byte_stream.readline)[0] File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tokenize.py", line 371, in detect_encoding encoding = find_cookie(first) File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tokenize.py", line 335, in find_cookie raise SyntaxError(msg)SyntaxError: invalid or missing encoding declaration for '/opt/homebrew/lib/python3.9/site-packages/coverage/tracer.cpython-39-darwin.so'The above exception was the direct cause of the following exception:Traceback (most recent call last): File "/Users/.../pylint/pylint/lint/pylinter.py", line 1014, in get_ast return MANAGER.ast_from_file(filepath, modname, source=True) File "/opt/homebrew/lib/python3.9/site-packages/astroid/manager.py", line 117, in ast_from_file return AstroidBuilder(self).file_build(filepath, modname) File "/opt/homebrew/lib/python3.9/site-packages/astroid/builder.py", line 114, in file_build raise AstroidSyntaxError(astroid.exceptions.AstroidSyntaxError: Python 3 encoding specification error or unknown encoding:invalid or missing encoding declaration for '/opt/homebrew/lib/python3.9/site-packages/coverage/tracer.cpython-39-darwin.so'During handling of the above exception, another exception occurred:Traceback (most recent call last): File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/Users/.../pylint/pylint/__main__.py", line 10, in <module> pylint.run_pylint() File "/Users/.../pylint/pylint/__init__.py", line 35, in run_pylint PylintRun(argv or sys.argv[1:]) File "/Users/.../pylint/pylint/lint/run.py", line 207, in __init__ linter.check(args) File "/Users/.../pylint/pylint/lint/pylinter.py", line 691, in check ast_per_fileitem = self._get_asts(fileitems, data) File "/Users/.../pylint/pylint/lint/pylinter.py", line 706, in _get_asts ast_per_fileitem[fileitem] = self.get_ast( File "/Users/.../pylint/pylint/lint/pylinter.py", line 1019, in get_ast self.add_message( File "/Users/.../pylint/pylint/lint/pylinter.py", line 1307, in add_message self._add_one_message( File "/Users/.../pylint/pylint/lint/pylinter.py", line 1202, in _add_one_message message_definition.check_message_definition(line, node) File "/Users/.../pylint/pylint/message/message_definition.py", line 116, in check_message_definition raise InvalidMessageError(pylint.exceptions.InvalidMessageError: Message E0001 must provide line, got None
Bug description
When
AstroidSyntaxError
is caught and asyntax-error
is raised, an assertion fails when a line number is lacking.I suppose we could either raise "fatal" instead or expand
_SCOPE_EXEMPT
to also includesyntax-error
.Configuration
No response
Command used
Pylint output
Expected behavior
E001
or perhaps a Fatal error
Pylint version
OS / Environment
No response
Additional dependencies
coverage==6.4.4
The text was updated successfully, but these errors were encountered: