Contact: fumanchu@aminus.org

Log in as guest/geniusql to create tickets

Changeset 214

Show
Ignore:
Timestamp:
11/05/07 14:35:46
Author:
fumanchu
Message:

logic: Bugfixes for Expression.is_constant.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/geniusql/logic.py

    r213 r214  
    368368        """Return True if self.func == (lambda: value), False otherwise.""" 
    369369        fc = self.func.func_code 
    370         return (fc.co_code == 'd\x01\x00S' and 
     370        if fc.co_code in ('d\x00\x00S', 'd\x01\x00S'): 
     371            # LOAD_CONST 0/1 0 RETURN_VALUE 
     372            if len(fc.co_consts) == 2 and fc.co_consts[1] == value: 
    371373                # i.e., fc.co_consts == (docstring or None, value) 
    372                 len(fc.co_consts) == 2 and fc.co_consts[1] == value) 
     374                return True 
     375        elif fc.co_code == 't\x00\x00S' and len(fc.co_consts) == 1: 
     376            # LOAD_CONST 0 0 RETURN_VALUE 
     377            return True 
     378        return False 
    373379 
    374380