pylint-bot / test

0 stars 0 forks source link

[2.0 bugs] SimpleNamespace causes any tests that ultimately import sys to fail on Python 3 #258

Closed pylint-bot closed 8 years ago

pylint-bot commented 9 years ago

Originally reported by: BitBucket: ceridwenv, GitHub: @ceridwen?


There's another builtin type in CPython 3.3+ called SimpleNamespace, exposed in types. I think it's implemented in C but I'm not certain. It's used for sys.implementation; I don't know if it's used anywhere else. When something tries to import a module containing a SimpleNamespace instance, ast_from_object eventually finds the following definition in types and adds it as an AssignNode:

SimpleNamespace = type(sys.implementation)

However, since that type call doesn't point to anything inference can understand, it ultimately causes tests to fail.


pylint-bot commented 9 years ago

Original comment by BitBucket: ceridwenv, GitHub: @ceridwen?:


Added SimpleNamespace to the builtins mock AST in e7139c4.