From ed38e6b1bb8491b1f3460e5e4dad651f20ee2c5b Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 8 Oct 2014 13:32:39 -0700 Subject: [PATCH] runner.gevent: Shift None check for topic_func earlier Avoid: Traceback (most recent call last): File "/.../pyvows/runner/gevent.py", line 97, in _run_setup_and_topic topic_list = get_topics_for(topic_func, ctx_obj) File "/.../pyvows/runner/utils.py", line 46, in get_topics_for 'Function %s does not have a code property' % topic_function) RuntimeError: Function None does not have a code property because VowsParallelRunner._run_setup_and_topic was calling get_topics_for (which chokes when its topic_function is None) before checking for a None value. The fixes a broken check from 59e67374 (topics can be none, we need to validate against that, 2014-06-02). --- pyvows/runner/gevent.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyvows/runner/gevent.py b/pyvows/runner/gevent.py index 49d3ff6..b317fe2 100644 --- a/pyvows/runner/gevent.py +++ b/pyvows/runner/gevent.py @@ -94,13 +94,13 @@ def _run_setup_and_topic(ctx_obj, index): try: topic_func = ctx_obj.topic + if topic_func is None: + return None + topic_list = get_topics_for(topic_func, ctx_obj) start_time = time.time() - if topic_func is None: - return None - topic = topic_func(*topic_list) ctx_result['topic_elapsed'] = elapsed(start_time) return topic