Closed pylint-bot closed 8 years ago
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?):
Add support for handling Uninferable nodes when calling as_string
Some object, for instance List or Tuple can have, after inference,
Uninferable as their elements, happening when their components
weren't couldn't be inferred properly. This means that as_string
needs to cope with expecting Uninferable nodes part of the other
nodes coming for a string transformation. The patch adds a visit
method in AsString and accept
on Yes / Uninferable nodes.
Closes issue #270.
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?):
Add support for handling Uninferable nodes when calling as_string
Some object, for instance List or Tuple can have, after inference,
Uninferable as their elements, happening when their components
weren't couldn't be inferred properly. This means that as_string
needs to cope with expecting Uninferable nodes part of the other
nodes coming for a string transformation. The patch adds a visit
method in AsString and accept
on Yes / Uninferable nodes.
Closes issue #270.
Original comment by Sylvain Thénault (BitBucket: sthenault, GitHub: @sthenault?):
this has nothing to do with what''s discussed here beside that it appears in the traceback. I see "var_type.as_string() == 'None'" appearing, and it seems to me that it shouldn't be the proper way to check that you've a node representing node. Unless I'm missing something ?
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?):
I don't think I understand. This problem was caused by a change in the inference, where the elements of a sequence couldn't be determined when doing multiplication, so that [unknown, unknown] * 2
became a list of for YES / Uninferable nodes after inferring the binary operation. as_string wasn't aware of this and crashed.
Indeed, var_type.as_string() == 'None' doesn't strike me as well as a proper way to do this check, it is coming from the new redefined-variable-type checker though.
Originally reported by: Florian Bruhin (BitBucket: The-Compiler, GitHub: @The-Compiler?)
After updating astroid from 1.3.8 to 1.4.0 and pylint from 1.4.4 to 1.5.0, with this code:
I get: