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
Resolving symlinks considered harmful #2127
Comments
Did you search for the reason in the git history ? It feel like a Chesterton's fence (we should not remove it until we know why it's here in the first place) |
Both absolute and real path lookups were added in cd76b49
This change added two tests – which incidentally still work after removing that |
As you can see from the diff we used |
Ah, yes, sorry, the real reason I'll ask there whether somebody can test this. |
Steps to reproduce
Current behavior
The problem which this archive exhibits is that
moat/micro/link.py
is a symlink that refers tomoat/micro/_embed/lib/moat/micro/link.py
. The directorymoat/micro
has an_init__.py
file whilemoat/micro/_embed/lib/moat/micro
does not.Now,
modpath_from_file_with_callback
, inastroid/mdutils.py
, calls astroid's_get_relative_base_path
function which callsrealpath
and thus resolves this symlink. As a result, pylint's "is this a proper module" callback looks for the__init__.py
file in the wrong place, decides that this is not a module, and refuses to process the import.Expected behavior
IMHO there's no good reason to call
realpath
on anything. Why not simply assume that the symlink is there for a good reason?python -c "from astroid import __pkginfo__; print(__pkginfo__.version)"
output2.14.2, but applies to master
The text was updated successfully, but these errors were encountered: