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
Here's an example where the parent of an attribute in a chained attribute is wrong, pointing to a following attribute instead.
#!python
from astroid import parse
module = parse('''
class Tags:
def extend(self): return 42
class Removed:
def __init__(self):
self.tags = Tags()
removed = Removed()
removed.tags.extend()
''')
expr = module.body[-1]
callfunc = expr.value
print("callfunc", callfunc)
print("parent of callfunc", callfunc.parent)
print("func of callfunc", callfunc.func)
print("parent of func of callfunc", callfunc.func.parent)
print("expr of callfunc.func", callfunc.func.expr)
print("parent of expr of callfunc.func", callfunc.func.expr.parent) # This should be the Name, instead it is extend
from ast import parse
module = parse('''
class Tags:
def extend(self): return 42
class Removed:
def __init__(self):
self.tags = Tags()
removed = Removed()
removed.tags.extend()
''')
expr = module.body[-1]
callfunc = expr.value
print("callfunc", callfunc)
print("func of callfunc", callfunc.func.attr)
print("expr of callfunc", callfunc.func.value.attr)
print("expr of expr of callfunc", callfunc.func.value.value)
Originally reported by: Claudiu Popa (BitBucket: PCManticore, GitHub: PCManticore)
Here's an example where the parent of an attribute in a chained attribute is wrong, pointing to a following attribute instead.
The text was updated successfully, but these errors were encountered: