[PEAK] Another RuleDispatch error with python 2.5

Phillip J. Eby pje at telecommunity.com
Sun Sep 17 17:39:33 EDT 2006


At 08:03 PM 9/17/2006 +0200, paul wrote:
>Hi,
>
>Running this code with Python 2.5rc1 (RuleDispatch-0.5a0.dev-r2100,
>win32, VS2003.NET, XP) fails. The commented convert_date() function
>however works. I tested with other types (decimal.Decimal) and it seems
>the error occurs as soon as .when() contains multiple tests and 'or'.'

Looks like a Python 2.5 grammar problem.  Specifically, 2.5's new 
conditional expressions throw a monkey in the works, so to speak.  A 
quickie fix would be to change this line (#62) in dispatch.ast_builder:

     test = curry(com_binary, 'Or')

to instead read:

     test = or_test = curry(com_binary, 'Or')

This *should* work, but strange things will happen if you use conditional 
expressions.

Unfortunately, there are likely deeper grammar issues afoot, because I'm 
still showing RuleDispatch's internal parse tests failing on 2.5.




More information about the PEAK mailing list