diff options
author | jcorgan | 2009-04-25 02:57:27 +0000 |
---|---|---|
committer | jcorgan | 2009-04-25 02:57:27 +0000 |
commit | 9d45055a028d83b5614121cf2152af1ab7056d68 (patch) | |
tree | 10a947245a08e30527146c44b149489d96f7307e /gnuradio-core/src | |
parent | 799654f02704f76659ea94c26e9ae3783bac7eba (diff) | |
download | gnuradio-9d45055a028d83b5614121cf2152af1ab7056d68.tar.gz gnuradio-9d45055a028d83b5614121cf2152af1ab7056d68.tar.bz2 gnuradio-9d45055a028d83b5614121cf2152af1ab7056d68.zip |
Generate more informative error message than recursion error
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10908 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r-- | gnuradio-core/src/python/gnuradio/gr/hier_block2.py | 2 | ||||
-rw-r--r-- | gnuradio-core/src/python/gnuradio/gr/top_block.py | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py index 3d3545a28..b43c5feda 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 b9c436a0a..71e401424 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): |