Pretty simple. I tried to do the following:
import amara
RDFA11_EXAMPLE = """\
<div vocab="http://schema.org/"
typeof="Person">
<span property="name">Manu Sporny</span>
<img rel="image" src="manu.jpg" />
<span property="jobTitle">CEO</span>
<div rel="address">
<span property="streetAddress">
1700 Kraft Drive, Suite 2408
</span>
...
</div>
<a rel="url"
href="http://manu.sporny.org/">
manu.sporny.org
</a>
</div>
"""
doc = amara.parse(RDFA11_EXAMPLE)
doc.xml_select(u'//*[@property|@resource|@rel]')
Traceback (most recent call last):
File "/tmp/foo.py", line 26, in <module>
doc.xml_select(u'//*[@property|@resource|@rel]')
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/util.py", line 52, in simple_evaluate
return ctx.evaluate(expr)
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/__init__.py", line 224, in evaluate
return parsed.evaluate(self)
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/expressions/__init__.py", line 65, in evaluate
return self.evaluate(context)
File "<ast-0>", line 0, in evaluate
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 161, in _boolean
if expr.evaluate_as_boolean(context):
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/expressions/__init__.py", line 70, in evaluate_as_boolean
self.compile_as_boolean(compiler)
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/expressions/nodesets.py", line 155, in compile_as_boolean
path.compile_as_boolean(compiler)
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/expressions/nodesets.py", line 78, in compile_as_boolean
return self._make_loop(compiler, found, empty)
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/expressions/nodesets.py", line 44, in _make_loop
for block in self._make_block(compiler):
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/expressions/nodesets.py", line 24, in _make_block
'LOAD_ATTR', 'size',
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/compiler/assembler.py", line 41, in emit
for opname in instructions:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 159, in _boolean
for node in nodes:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 161, in _boolean
if expr.evaluate_as_boolean(context):
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/expressions/__init__.py", line 70, in evaluate_as_boolean
self.compile_as_boolean(compiler)
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/expressions/nodesets.py", line 155, in compile_as_boolean
path.compile_as_boolean(compiler)
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/expressions/nodesets.py", line 78, in compile_as_boolean
return self._make_loop(compiler, found, empty)
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/expressions/nodesets.py", line 44, in _make_loop
for block in self._make_block(compiler):
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/expressions/nodesets.py", line 24, in _make_block
'LOAD_ATTR', 'size',
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/compiler/assembler.py", line 41, in emit
for opname in instructions:
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/locationpaths/predicates.py", line 161, in _boolean
if expr.evaluate_as_boolean(context):
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/expressions/__init__.py", line 72, in evaluate_as_boolean
docstring=unicode(self))
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/compiler/__init__.py", line 45, in compile
firstlineno)
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/compiler/assembler.py", line 60, in assemble
stacksize = self._compute_stack_size()
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/compiler/assembler.py", line 202, in _compute_stack_size
return walk(self.entry, 0, 0)
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/compiler/assembler.py", line 192, in walk
maxsize = walk(instr.target, size, maxsize)
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/compiler/assembler.py", line 198, in walk
maxsize = walk(block.next, size, maxsize)
File "/Users/uche/.local/lib/python2.7/site-packages/amara/xpath/compiler/assembler.py", line 187, in walk
raise RuntimeError("unhandled instruction: %r" % instr)
RuntimeError: unhandled instruction: <instr at 0x10b236940: opname='<block 1, offset 0>', oparg=None, target=None>
This only seems to happen when the union expression is used. You can do any of the following without the error:
But any combination of 2 of the attributes in a union expression does trigger the exception.