Skip to content

Trailing comma after **kwargs not removed when targeting py35 #1463

@alexomics

Description

@alexomics

Describe the bug
When running black with -t py35 code that raises syntax errors is left unchanged.

To Reproduce:

example.py

def func(
    a_long_variable_name: int = 1000000,
    another_long_variable_name: int = 1000000,
    **kwargs,
):
    pass

This example is valid in python 3.7 but not in python 3.5.

  1. Run Black on it like so:
    black --target-version=py35 example.py
  2. File remains unchanged

Expected behavior
I would expect black to tell me that the trailing comma is a syntax error in the target python version, or remove the trailing comma.

Environment:

  • black: 19.10b0
  • OS: Docker using python:3.7-buster (Python 3.7.7 (default, May 16 2020, 07:16:36))

Does this bug also happen on master?
Yes

Additional context
Maybe related #419 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    T: bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions