@@ -125,11 +125,12 @@ def _process_args(self, func_ast, code_lines, args, kwargs) -> Generator[DebugAr
125
125
yield self .output_class .arg_class (arg , name = ast_node .id )
126
126
elif isinstance (ast_node , self .complex_nodes ):
127
127
# TODO replace this hack with astor when it get's round to a new release
128
- start_line , start_col = ast_node .lineno - 1 , ast_node .col_offset
129
- end_line , end_col = len (code_lines ) - 1 , None
128
+ start_line , start_col = arg_offsets [i ]
130
129
131
- if i < len (arg_offsets ) - 1 :
130
+ if i + 1 < len (arg_offsets ):
132
131
end_line , end_col = arg_offsets [i + 1 ]
132
+ else :
133
+ end_line , end_col = len (code_lines ) - 1 , None
133
134
134
135
name_lines = []
135
136
for l in range (start_line , end_line + 1 ):
@@ -193,7 +194,12 @@ def _parse_code(self, call_frame, func_regex, filename) -> Tuple[Optional[ast.AS
193
194
@classmethod
194
195
def _get_offsets (cls , func_ast ):
195
196
for arg in func_ast .args :
196
- yield arg .lineno - 1 , arg .col_offset
197
+ start_line , start_col = arg .lineno - 1 , arg .col_offset
198
+
199
+ # horrible hack for http://bugs.python.org/issue31241
200
+ if isinstance (arg , (ast .ListComp , ast .GeneratorExp )):
201
+ start_col -= 1
202
+ yield start_line , start_col
197
203
for kw in func_ast .keywords :
198
204
yield kw .value .lineno - 1 , kw .value .col_offset - len (kw .arg ) - 1
199
205
0 commit comments