Open pylint-bot opened 8 years ago
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: PCManticore):
I don't think this needs to be fixed in builtin_lookup, it should do only lookup and fail if it's not possible to do so. Any other use case should belong somewhere else.
Without taking a close look at the problem, maybe this is related with _io / io discrepancy that the previous code hardcoded? https://bitbucket.org/logilab/astroid/src/473f94bc7afddb40295c6225861512e9485fbd3e/astroid/raw_building.py?at=default&fileviewer=file-view-default#raw_building.py-44
Originally reported by: BitBucket: ceridwenv, GitHub: ceridwenv
I've already tweaked builtin_lookup() to accommodate cases where ast_from_object() is creating an AssignName node because of an alias to the same object in the builtins module. However, there's another issue that's less clear how to solve: in some cases, the builtins module has objects that actually belong to another module. The proximate test failure caused by this case is that on Python3, open() is imported from io:
However, there are other cases. ast_from_object() tries to create an AST that's as close as possible to the AST that would create the object if it were compiled. I think this should probably be solved in builtin_lookup(), but what's the best way to do it?