From: jcorgan Date: Sat, 25 Apr 2009 02:57:27 +0000 (+0000) Subject: Generate more informative error message than recursion error X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=9d45055a028d83b5614121cf2152af1ab7056d68;p=debian%2Fgnuradio Generate more informative error message than recursion error git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10908 221aa14e-8319-0410-a670-987f0aec2ac5 --- diff --git a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py index 3d3545a2..b43c5fed 100644 --- a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py +++ b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py @@ -45,6 +45,8 @@ class hier_block2(object): """ Pass-through member requests to the C++ object. """ + if not hasattr(self, "_hb"): + raise RuntimeError("hier_block2: invalid state--did you forget to call gr.hier_block2.__init__ in a derived class?") return getattr(self._hb, name) def connect(self, *points): diff --git a/gnuradio-core/src/python/gnuradio/gr/top_block.py b/gnuradio-core/src/python/gnuradio/gr/top_block.py index b9c436a0..71e40142 100644 --- a/gnuradio-core/src/python/gnuradio/gr/top_block.py +++ b/gnuradio-core/src/python/gnuradio/gr/top_block.py @@ -89,6 +89,8 @@ class top_block(object): self._tb = top_block_swig(name) def __getattr__(self, name): + if not hasattr(self, "_tb"): + raise RuntimeError("top_block: invalid state--did you forget to call gr.top_block.__init__ in a derived class?") return getattr(self._tb, name) def start(self):