jpadilla/black-playground

Error on match..case

BZab opened this issue · 0 comments

No matter what settings I select in the playground, 3.10 enabled, main / stable or Enable potentially disruptive style changes that may be added to Black's main functionality in the next major release. enabled - it doesn't parse and beautify match .. case statement.

Error message:
cannot use --safe with this file; failed to parse source file AST: invalid syntax (<unknown>, line 4) This could be caused by running Black with an older Python version that does not support new syntax used in your source file.

Minimal code example:

import random

x = random.randint(1,10)
match x:
    case 1:
        print('a')
    case 2:
        print('b')
    case default:
        print('c')