do not override errors from descriptors on modules

This commit is contained in:
Benjamin Peterson 2014-04-24 19:29:23 -04:00
parent 7b9ff0e6da
commit 1184e266b9
2 changed files with 17 additions and 10 deletions

View file

@ -227,6 +227,14 @@ a = A(destroyed)"""
b"len = len",
b"shutil.rmtree = rmtree"})
def test_descriptor_errors_propogate(self):
class Descr:
def __get__(self, o, t):
raise RuntimeError
class M(ModuleType):
melon = Descr()
self.assertRaises(RuntimeError, getattr, M("mymod"), "melon")
# frozen and namespace module reprs are tested in importlib.