Pylint: syntax error on import

Created on 23 Jun 2019  路  7Comments  路  Source: PyCQA/pylint

Steps to reproduce

  1. Create Python module containing import inspect
  2. run pylint on this file

Current behavior

************* Module test
test.py:1:0: C0111: Missing module docstring (missing-docstring)
test.py:1:0: E0001: Cannot import 'inspect' due to syntax error 'invalid syntax (<unknown>, line 1328)' (syntax-error)
test.py:1:0: W0611: Unused import inspect (unused-import)

-----------------------------------------------------------------------
Your code has been rated at -60.00/10 (previous run: -50.00/10, -10.00)

Expected behavior

No syntax error on importing inspect

> python.exe -V
Python 3.8.0b1
> python.exe -c 'import inspect'
> [no error]

pylint --version output

pylint 2.3.1
astroid 2.2.5
Python 3.8.0b1 (tags/v3.8.0b1:3b5deb0116, Jun  4 2019, 19:52:55) [MSC v.1916 64 bit (AMD64)]

All 7 comments

Maybe a Python 3.8 issue - I can't reproduce the issue with Python 3.7.4rc1

It is indeed a py38 thing, he offending line is:

def getcallargs(func, /, *positional, **named):

This chases back to astroid not supporting all of the 3.8 syntax (https://github.com/PyCQA/astroid/issues/675) which in turn falls back to typed_ast (https://github.com/python/typed_ast/issues/118)

Yeah, we don't currently support Python 3.8. astroid partially does, but there still some work to be done against Python 3.8 beta.

I have the same error with respect to importing. I could suppress it via .pylintrc or .prospector.yaml for E0001 or syntax-error. But wouldn't that suppress errors in my code too?

@Fernal73 Please open a separate issue if you have more details. This one was caused by not supporting Python 3.8 but the latest versions support Python 3.8.

Arch Linux on Termux:
pylint --version
pylint 2.3.1
astroid 2.2.5
Python 3.8.0 (default, Nov 14 2019, 15:41:40)
[GCC 8.3.0]

Termux:
$ pylint --version
pylint 2.3.1
astroid 2.2.5
Python 3.8.0 (default, Nov 20 2019, 20:44:46)
[Clang 8.0.7 (https://android.googlesource.com/toolchain/clang b55f2d4ebfd35bf6

import random
throws an error.

Should this be a pylint issue or should I post it on the Github projects for Termux and/or ArchLinux for Termux?

Was this page helpful?
0 / 5 - 0 ratings