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
I don't understand how this error didn't happen before, given the Python 2/3 differences. I assume that not testing all the string methods is deliberate, but I should also mention there are some string methods that are only on Python3, like isidentifier().
The immediate cause of this bug is that brain_builtin_inference was trying to alter the locals dictionary of str, bytes, and unicode ClassDef nodes. I changed this so that it instead replaces FunctionDef nodes in the body of those ClassDef nodes with others, which does fix the immediate problem. Unfortunately, there are still issues here.
The version differences are still not being handled correctly---there are calls that will fail on Python 3 or Python 2 that astroid won't recognize.
Astroid will also incorrectly infer that some arguments can be passed by keyword when they can't be.
Because this hard-codes type(b'') is type('') , when from __future__ import unicode_literals is in effect I'm concerned that things will break.
Because my new functions in raw_building don't create duplicate copies for the same object, one of str, bytes, and unicode on the various versions will be a Name node, not a ClassDef. I'm not sure that the builtin lookups are correctly handling the indirection. On Python 2, because bytes is str and ast_from_object encounters bytes first, it builds a ClassDef node for bytes and a Name node for str. I worked around the problems introduced with the following ugly hack:
For .2, that's true, there's currently no mechanism for handling this. Maybe something can be added along with the issue that's proposing a new API for the Arguments node, which could be enforced by Pylint with a specific rule.
This is improved in 8aca20dd1814, which handles alternate names in the builtins module. It roughly fixes 4 in the list above but doesn't tackle the other issues.
Originally reported by: BitBucket: ceridwenv, GitHub: ceridwenv
I'm getting the following two errors.
The first error I'm reasonably sure is related to this:
I don't understand how this error didn't happen before, given the Python 2/3 differences. I assume that not testing all the string methods is deliberate, but I should also mention there are some string methods that are only on Python3, like isidentifier().
The text was updated successfully, but these errors were encountered: