Semgrep: NoTokenLocation error during python fstring parse

Created on 18 Nov 2020  路  5Comments  路  Source: returntocorp/semgrep

Semgrep at develop, running with $ semgrep -e '$X' -l py semgrep/semgrep gives me:

an internal error occured while invoking semgrep-core:
    unknown exception: Parse_info.NoTokenLocation("Match returned an empty list with no token location information; this may be fixed by adding enclosing token information (e.g. bracket or parend tokens) to the list's enclosing node type.")
bug matching high

Most helpful comment

Even simpler is https://semgrep.dev/s/Lrxo

All 5 comments

Minimal Reproduction: https://semgrep.dev/s/Er9e

Even simpler is https://semgrep.dev/s/Lrxo

Looks like it's a regression between 0.27.0 and 0.28.0.

Note that there is absolutely no difference between ASTs:

0.28.0 AST:

    {
      "ExprStmt": [
        {
          "Call": [
            {
              "IdSpecial": [
                {
                  "InterpolatedConcat": "FString"
                },
                "()"
              ]
            },
            [
              {
                "Arg": {
                  "L": {
                    "String": [
                      "x",
                      "()"
                    ]
                  }
                }
              }
            ]
          ]
        },
        "()"
      ]
    }

0.27.0 AST:

    {
      "ExprStmt": [
        {
          "Call": [
            {
              "IdSpecial": [
                {
                  "InterpolatedConcat": "FString"
                },
                "()"
              ]
            },
            [
              {
                "Arg": {
                  "L": {
                    "String": [
                      "x",
                      "()"
                    ]
                  }
                }
              }
            ]
          ]
        },
        "()"
      ]
    }

This is blocking dog-fooding, so placing as high prio

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mcbryde picture mcbryde  路  5Comments

ghbren picture ghbren  路  5Comments

Mandawi picture Mandawi  路  4Comments

ajinabraham picture ajinabraham  路  6Comments

msorens picture msorens  路  5Comments