[PEAK] Strange dispatch problem after cvs up
Jay Parlar
parlar at gmail.com
Thu Apr 21 09:42:47 EDT 2005
Now that my first bit is working again, more of my tests seem to be
failing, in a different way.
Traceback (most recent call last):
File outputlogic.py", line 409, in Logic
[set_implementation.when("(len(ctrl.leaves) == 1 "
File "c:\Python24\Lib\site-packages\dispatch\functions.py", line 690, in when
return self._decorate(cond)
File "c:\Python24\Lib\site-packages\dispatch\functions.py", line
577, in _decorate
cond = self.parseRule(cond,frame=frame) or cond
File "<string>", line 10, in parseRule
File "c:\Python24\Lib\site-packages\dispatch\functions.py", line
440, in parseRule
return self.parse(rule, frame.f_locals, frame.f_globals)
File "c:\Python24\Lib\site-packages\dispatch\functions.py", line 326, in parse
return parse_expr(expr_string,builder)
File "c:\Python24\Lib\site-packages\dispatch\ast_builder.py", line
383, in parse_expr
return build(builder, parser.expr(expr).totuple(1)[1])
File "c:\Python24\Lib\site-packages\dispatch\ast_builder.py", line
378, in build
return production[nodelist[0]](builder,nodelist)
File "c:\Python24\Lib\site-packages\dispatch\ast_builder.py", line
51, in com_binary
return getattr(builder,opname)(items)
File "c:\Python24\Lib\site-packages\dispatch\predicates.py", line 609, in And
return reduce(operator.and_,[build(self,expr) for expr in items])
File "c:\Python24\lib\site-packages\dispatch\strategy.py", line
1167, in __and__
return Predicate([ (a & b) for a in self for b in other ])
TypeError: iteration over non-sequence
The dispatch rule it's failing on is:
[set_implementation.when("(len(ctrl.leaves) == 1 "
"or len(ctrl.leaves) > 1) "
"and ctrl.set != 'set'")]
def set_implementation(self, ctrl):
return ""
I poked at the strategy.py code a little, and got this when doing a
'print self' and
'print other'
[Signature((Call(<built-in function len>, <dispatch.predicates.Getattr
object at 0x00C0CCF0>), <class
'dispatch.strategy.InequalityNode'>)=Inequality(==1)),
Signature((Call(<built-in function len>, <dispatch.predicates.Getattr
object at 0x00C0CD50>), <class
'dispatch.strategy.InequalityNode'>)=Inequality(>1))]
Signature((<dispatch.predicates.Getattr object at 0x00C0CC90>, <class
'dispatch.strategy.InequalityNode'>)=Inequality(<>'set'))
So 'self' is a list, while 'other' is just a Signature object (that
has no __iter__ method, by the way).
The dir() of the 'other' variable is as follows:
['__and__', '__class__', '__delattr__', '__doc__', '__eq__',
'__getattribute__', '__hash__', '__init__', '__module__', '__ne__',
'__new__', '__or__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__slots__', '__str__', 'data', 'get', 'implies',
'items', 'keys']
I'm starting to get the feeling that something is messed up in my
local install, for me to be having all these problems now. But this
code was all working perfectly two days ago, before I did the cvs up.
Jay P.
More information about the PEAK
mailing list