Amara 2.0. Amara XML toolkit is an open-source collection of Python tools for XML processing, not just tools that happen to be written in Python, but tools built from the ground up to use Python idioms and take advantage of the many advantages of Python over other programming languages.
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:
doc.xml_select(u'//*[@property]')
doc.xml_select(u'//*[@resource]')
doc.xml_select(u'//*[@rel]')
But any combination of 2 of the attributes in a union expression does trigger the exception.
Pretty simple. I tried to do the following:
Throws the following exception:
This only seems to happen when the union expression is used. You can do any of the following without the error:
doc.xml_select(u'//*[@property]')
doc.xml_select(u'//*[@resource]')
doc.xml_select(u'//*[@rel]')
But any combination of 2 of the attributes in a union expression does trigger the exception.