Ticket #135: ticket-135.patch

File ticket-135.patch, 1.8 KB (added by ksmith, 6 years ago)
  • Cython/Compiler/Symtab.py

    # HG changeset patch
    # User Kurt Smith <kwsmith1@wisc.edu>
    # Date 1237319878 18000
    # Node ID f225a23de8ff8390a3b78e47f10a9ba628a1a3ad
    # Parent  e2365a6d00b8d0cdb665699e840a8f052d471e37
    Fix 135 -- scope objects have return_type set to None by default
    
    diff -r e2365a6d00b8 -r f225a23de8ff Cython/Compiler/Symtab.py
    a b  
    235235        self.pystring_entries = [] 
    236236        self.buffer_entries = [] 
    237237        self.control_flow = ControlFlow.LinearControlFlow() 
     238        self.return_type = None 
    238239         
    239240    def start_branching(self, pos): 
    240241        self.control_flow = self.control_flow.start_branch(pos) 
  • (a) /dev/null vs. (b) b/tests/errors/return_outside_function_T135.pyx

    diff -r e2365a6d00b8 -r f225a23de8ff tests/errors/return_outside_function_T135.pyx
    a b  
     1return 'bar' 
     2class A: 
     3    return None 
     4 
     5_ERRORS = u''' 
     61:0: Return not inside a function body 
     73:4: Return not inside a function body 
     8''' 
  • tests/errors/return_outside_function_T135.pyx

    # HG changeset patch
    # User Kurt Smith <kwsmith1@wisc.edu>
    # Date 1237320614 18000
    # Node ID f153d2da27b08c0fb35827d6b545007fe15cd6f3
    # Parent  f225a23de8ff8390a3b78e47f10a9ba628a1a3ad
    Fix 135 -- small addition to test case.
    
    diff -r f225a23de8ff -r f153d2da27b0 tests/errors/return_outside_function_T135.pyx
    a b  
    11return 'bar' 
    22class A: 
     3    return None 
     4 
     5cdef class B: 
    36    return None 
    47 
    58_ERRORS = u''' 
    691:0: Return not inside a function body 
    7103:4: Return not inside a function body 
     116:4: Return not inside a function body 
    812'''