From: Dmitry Selyutin Date: Wed, 29 Sep 2021 11:44:52 +0000 (+0000) Subject: decoder/helpers: use globals() with exception X-Git-Tag: sv_maxu_works-initial~801 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2289b82a197319361243c79d63a6c1706d4781e8;p=openpower-isa.git decoder/helpers: use globals() with exception --- 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__':