-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code attempted executed when checking module with name 'platform' #3386
Comments
Thanks for the report! We shouldn't import any modules when they are named like components of |
``python -m pylint ...`` adds the current working directory as the first element of ``sys.path``. This opens up a potential security hole where ``pylint`` will import user level code as long as that code resides in modules having the same name as stdlib or pylint's own modules. Close #3386
``python -m pylint ...`` adds the current working directory as the first element of ``sys.path``. This opens up a potential security hole where ``pylint`` will import user level code as long as that code resides in modules having the same name as stdlib or pylint's own modules. Close #3386
``python -m pylint ...`` adds the current working directory as the first element of ``sys.path``. This opens up a potential security hole where ``pylint`` will import user level code as long as that code resides in modules having the same name as stdlib or pylint's own modules. Close #3386
@Tenzer This should be fixed with the latest |
The minimal test case I added in the OP (
At this point the command hangs and only exits after I press Ctrl+C twice. If I name the file
|
Thanks for confirming! Just to make sure I understand, you are using |
I've just renamed my With the latest released version:
With the version from the master branch:
Enabling multiple jobs makes it break again:
Also, doesn't seem to help on all file names,
I hope that helps. |
This has been fixed with #3411. The only issue that remains is the |
Great! Thank you for fixing this! |
PyLint 2.5's new way of importing code doesn't work with our apps. See: https://github.com/PyCQA/pylint/blob/303b8d852e469379cd0f1a8891a018de5e39a966/ChangeLog#L83-L90 pylint-dev/pylint#3386 pylint-dev/pylint#3411 https://hypothes-is.slack.com/archives/C1MA4E9B9/p1587994973069200
PyLint 2.5's new way of importing code doesn't work with our apps. See: https://github.com/PyCQA/pylint/blob/303b8d852e469379cd0f1a8891a018de5e39a966/ChangeLog#L83-L90 pylint-dev/pylint#3386 pylint-dev/pylint#3411 https://hypothes-is.slack.com/archives/C1MA4E9B9/p1587994973069200
Which means we need to explicitly set PYTHONPATH, otherwise test_foo won't find module foo, see <pylint-dev/pylint#3386>.
Which means we need to explicitly set PYTHONPATH, otherwise test_foo won't find module foo, see <pylint-dev/pylint#3386>. Tested-by: Travis
pylint 2.5.x's way of importing modules breaks the test scripts module imports https://github.com/PyCQA/pylint/blob/303b8d852e469379cd0f1a8891a018de5e39a966/ChangeLog#L83-L90 pylint-dev/pylint#3411 pylint-dev/pylint#3386
This might be a problem with Astroid, but I'll try here first as it's easy to reproduce with Pylint:
Steps to reproduce
echo "import non_existing_module" > platform.py
pylint platform.py
Current behavior
Gives the following stack trace:
Expected behavior
Pylint's checks will run like usual.
pylint --version output
I am not able to reproduce this on Python 3.7.6.
I've also been able to reproduce the problem with slightly different stack traces by naming the file the following:
__future__.py
array.py
ast.py
astroid.py
brain_numpy_utils.py
collections.py
configparser.py
contextlib.py
and there are probably many more. I tried to go for the list of modules imported by Astroid when it is executing.
The text was updated successfully, but these errors were encountered: