transforms: Don't try to call has_child on parent nodes that are None #2261

Merged
merged 1 commit into from Jan 22, 2016

Conversation

Projects
None yet
2 participants
Contributor

mitya57 commented Jan 22, 2016

Otherwise the build can fail with the following error:

  File "/usr/lib/python2.7/dist-packages/sphinx/environment.py", line 791, in read_doc
    pub.publish()
  File "/usr/lib/python2.7/dist-packages/docutils/core.py", line 218, in publish
    self.apply_transforms()
  File "/usr/lib/python2.7/dist-packages/docutils/core.py", line 199, in apply_transforms
    self.document.transformer.apply_transforms()
  File "/usr/lib/python2.7/dist-packages/docutils/transforms/__init__.py", line 171, in apply_transforms
    transform.apply(**kwargs)
  File "/usr/lib/python2.7/dist-packages/sphinx/transforms.py", line 124, in apply
    if has_child(node.parent, nodes.caption):
  File "/usr/lib/python2.7/dist-packages/sphinx/transforms.py", line 117, in has_child
    return any(isinstance(child, cls) for child in node)
TypeError: 'NoneType' object is not iterable

The error can be reproduced with lp:autopilot/legacy branch from Launchpad.

transforms: Don't try to call has_child on parent nodes that are None
Otherwise the build can fail with the following error:

      File "/usr/lib/python2.7/dist-packages/sphinx/environment.py", line 791, in read_doc
        pub.publish()
      File "/usr/lib/python2.7/dist-packages/docutils/core.py", line 218, in publish
        self.apply_transforms()
      File "/usr/lib/python2.7/dist-packages/docutils/core.py", line 199, in apply_transforms
        self.document.transformer.apply_transforms()
      File "/usr/lib/python2.7/dist-packages/docutils/transforms/__init__.py", line 171, in apply_transforms
        transform.apply(**kwargs)
      File "/usr/lib/python2.7/dist-packages/sphinx/transforms.py", line 124, in apply
        if has_child(node.parent, nodes.caption):
      File "/usr/lib/python2.7/dist-packages/sphinx/transforms.py", line 117, in has_child
        return any(isinstance(child, cls) for child in node)
    TypeError: 'NoneType' object is not iterable

The error could be reproduced with lp:autopilot/legacy branch from Launchpad.
Owner

birkenfeld commented Jan 22, 2016

Thanks!

birkenfeld added a commit that referenced this pull request Jan 22, 2016

Merge pull request #2261 from mitya57/stable
transforms: Don't try to call has_child on parent nodes that are None

@birkenfeld birkenfeld merged commit f2d264f into sphinx-doc:stable Jan 22, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment