From 2289b82a197319361243c79d63a6c1706d4781e8 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Wed, 29 Sep 2021 11:44:52 +0000 Subject: [PATCH] decoder/helpers: use globals() with exception --- src/openpower/decoder/helpers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/openpower/decoder/helpers.py b/src/openpower/decoder/helpers.py index 84300ba0..a11081bc 100644 --- a/src/openpower/decoder/helpers.py +++ b/src/openpower/decoder/helpers.py @@ -458,7 +458,10 @@ class ISACallerHelper: return SelectableInt(value.value & ((1 << bits) - 1), self.XLEN) def __getattr__(self, attr): - return getattr(sys.modules[ISACallerHelper.__module__], attr) + try: + return globals()[attr] + except KeyError: + raise AttributeError(attr) if __name__ == '__main__': -- 2.30.2