Closed pylint-bot closed 8 years ago
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):
Both of them. I fixed it without thinking on it, but we can leave it as a reminder. You can remove yourself from the assignee if you want, sorry about the noise. :-)
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):
Use the new .ctx attribute for subscripts for detecting in which context the node was used. Closes issue #705.
Originally reported by: Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore)
The current code of unsubscriptable-object treats all Subscript nodes the same, even though the context for them can be different. For instance, the context for the Subscript node from
x[1] = 2
is Store, meaning that a__setitem__
method will be invoked instead of__getitem__
and it's not required for the said object to have it implemented.For pylint 1.5.0 we might solve this by verifying explicitly on each side of the assignment operator the subscript node is, but for pylint 1.6.0 and onward, we might use the solution provided by https://bitbucket.org/logilab/astroid/issues/267/add-a-context-for-certain-nodes-similar-to in order to detect our current context.