diff options
author | Matt Mills <mmills@2bn.net> | 2021-09-18 12:43:30 -0600 |
---|---|---|
committer | Martin Braun <martin@gnuradio.org> | 2021-10-26 03:58:30 -0700 |
commit | 4457eb145b8078614da1d4b64add6282e4ab8d5d (patch) | |
tree | 05954a751ae2a8cea1b742591737a10ab51c693f /gnuradio-runtime/python | |
parent | 862974e0a908d42972d88e932451fde83e8e1283 (diff) |
gr-runtime: Change hier_block2.py __getattr__ to avoid recursive loop in exception
gnuradio-runtime: hier_block2.py __getattr__ recursive loop bug fix #5072
Signed-off-by: Matt Mills <mmills@2bn.net>
Diffstat (limited to 'gnuradio-runtime/python')
-rw-r--r-- | gnuradio-runtime/python/gnuradio/gr/hier_block2.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gnuradio-runtime/python/gnuradio/gr/hier_block2.py b/gnuradio-runtime/python/gnuradio/gr/hier_block2.py index 79bdd5abfc..cbb6e77392 100644 --- a/gnuradio-runtime/python/gnuradio/gr/hier_block2.py +++ b/gnuradio-runtime/python/gnuradio/gr/hier_block2.py @@ -75,11 +75,16 @@ class hier_block2(object): """ Pass-through member requests to the C++ object. """ - if not hasattr(self, "_impl"): + + try: + object.__getattribute__(self, "_impl") + except AttributeError as exception: raise RuntimeError( "{0}: invalid state -- did you forget to call {0}.__init__ in " - "a derived class?".format(self.__class__.__name__)) + "a derived class?".format(object.__getattribute__(self.__class__, "__name__"))) from exception + return getattr(self._impl, name) + # FIXME: these should really be implemented # in the original C++ class (gr_hier_block2), then they would all be inherited here |