call site 0 for code.Source.isparseable
code/testing/test_source.py - line 159
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
   def test_getstatementrange_within_constructs(self):
       source = Source("""\
               try:
                   try: 
                       raise ValueError
                   except SomeThing: 
                       pass 
               finally:
                   42
           """)
       assert len(source) == 7
       assert source.getstatementrange(0) == (0, 7) 
       assert source.getstatementrange(1) == (1, 5) 
       assert source.getstatementrange(2) == (2, 3)
->     assert source.getstatementrange(3) == (1, 5)
       assert source.getstatementrange(4) == (4, 5) 
       assert source.getstatementrange(5) == (0, 7)
       assert source.getstatementrange(6) == (6, 7) 
code/source.py - line 125
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
   def getstatementrange(self, lineno):
       """ return (start, end) tuple which spans the minimal 
               statement region which containing the given lineno.
           """
       # XXX there must be a better than these heuristic ways ...
       # XXX there may even be better heuristics :-)
       if not (0 <= lineno < len(self)):
           raise IndexError("lineno out of range")
   
       # 1. find the start of the statement
       from codeop import compile_command
       for start in range(lineno, -1, -1):
           trylines = self.lines[start:lineno+1]
           # quick hack to indent the source and get it as a string in one go
           trylines.insert(0, 'def xxx():')
           trysource = '\n '.join(trylines)
           #              ^ space here
           try:
               compile_command(trysource)
           except (SyntaxError, OverflowError, ValueError):
               pass
           else:
               break   # got a valid or incomplete statement
   
       # 2. find the end of the statement
       for end in range(lineno+1, len(self)+1):
           trysource = self[start:end]
->         if trysource.isparseable():
               break
   
       return start, end