weixin_39605414 2020-11-21 16:46
浏览 0

Range marker fails with rida.strip().split(maxsplit=1)

Original report by me.


rida.strip().split(maxsplit=1)

该提问来源于开源项目:thonny/thonny

  • 写回答

6条回答 默认 最新

  • weixin_39605414 2020-11-21 16:46
    关注

    Original comment by Xin Rong (Bitbucket: ronxin GitHub: ronxin ).

    It seems that ast_utils.mark_text_ranges() generates inaccurate results whenever there is a keyword argument and no positional arguments in a function call.

    For example,

    
    import ast
    import ast_utils
    code = u'f(x=1)'
    node = ast.parse(code)
    ast_utils.mark_text_ranges(node, code)
    func = node.body[0].value.func
    code[func.col_offset:func.end_col_offset]
    

    The output is expected to be f, but the actual output is f(x.

    I can submit a pull request for this.

    评论

报告相同问题?