Skip to content

Comments

runner.gevent: Shift None check for topic_func earlier#115

Open
wking wants to merge 1 commit intoheynemann:masterfrom
wking:none-topic-func
Open

runner.gevent: Shift None check for topic_func earlier#115
wking wants to merge 1 commit intoheynemann:masterfrom
wking:none-topic-func

Conversation

@wking
Copy link
Contributor

@wking wking commented Oct 8, 2014

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 it's topic_function is None) before
checking for a None value.

The fixes a broken check from 59e6737 (topics can be none, we need to
validate against that, 2014-06-02).

wking added a commit to wking/tornado_pyvows that referenced this pull request Oct 8, 2014
1d264b9 (Pyvows 2.0.5 has broken tornado_pyvows, 2014-05-19)
mentioned pyVows 2.0.5, but also blocked 2.0.4.  Since then, there has
been a 2.0.6 release which tried to fix this issue 59e67374 (topics
can be none, we need to validate against that, 2014-06-02, [1]) but
failed [2].  Instead of ignoring all future pyVows development, only
blacklist the versions we know to be broken.

[1]: heynemann/pyvows@59e6737
[2]: heynemann/pyvows#115
     Summary: runner.gevent: Shift None check for topic_func earlier
     Date: 2014-10-08
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 59e6737 (topics can be none, we need to
validate against that, 2014-06-02).
@coreypobrien
Copy link
Collaborator

This seems pretty innocuous, but I'm a little confused about when topic_func could ever be None? Maybe @heynemann could explain the original change? It seems like topic_func must always be a function. If ctx_obj.topic can be a non-function, we should be guarding against more than just None.

@wking
Copy link
Contributor Author

wking commented Oct 9, 2014

On Wed, Oct 08, 2014 at 05:41:53PM -0700, coreypobrien wrote:

This seems pretty innocuous, but I'm a little confused about when
topic_func could ever be None?

I hit this from the thumbor vows, but I didn't look into the
particular vow that was causing trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants