Contact: fumanchu@aminus.org

Log in as guest/geniusql to create tickets

Changeset 178

Show
Ignore:
Timestamp:
09/25/07 01:30:29
Author:
fumanchu
Message:

New test and fix for adding Expressions with LOAD_DEREF instructions.

Files:

Legend:

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

    r177 r178  
    248248            newindex = self.const_index(value) 
    249249            self.newcode[-2:] = [newindex & 0xFF, newindex >> 8] 
     250     
     251    def visit_LOAD_DEREF(self, lo, hi): 
     252        src = self.instr_index[self.cursor] 
     253        if src and hasattr(src, '_func'): 
     254            # name = self.co_freevars[lo + (hi << 8)] 
     255            value = src._func.func_closure[lo + (hi << 8)] 
     256            value = codewalk.deref_cell(value) 
     257            newindex = self.const_index(value) 
     258            self.tail(3, 'LOAD_CONST', newindex & 0xFF, newindex >> 8) 
    250259 
    251260 
  • trunk/geniusql/test/test_logic.py

    r177 r178  
    101101            'and ((x.DirectoryID == None) or (x.DirectoryID == 0))') 
    102102         
     103        birth_month = 3 
    103104        base_expr = logic.Expression(lambda x: x.BirthDate != None) 
    104         stnd_expr = logic.Expression(lambda x: month(x.BirthDate) == 3 and 
     105        stnd_expr = logic.Expression(lambda x: month(x.BirthDate) == birth_month and 
    105106                                     day(x.BirthDate) == 12) 
    106107        combo = base_expr + stnd_expr