Skip to content

Keyword arguments in super should suppress the UP008 fix #19096

Open
@dscorbett

Description

@dscorbett

Summary

The fix for super-call-with-parameters (UP008) should be suppressed when the super call has any keyword arguments, or else it changes the program’s behavior.

Playground

$ cat >up008.py <<'# EOF'
class Ord(int):
    def __len__(self):
        return super(Ord, self, uhoh=True, **{"error": True}).bit_length()
print(len(Ord(8)))
# EOF

$ python up008.py 2>&1 | tail -n 1
TypeError: super() takes no keyword arguments

$ ruff --isolated check up008.py --select UP008 --unsafe-fixes --fix
Found 1 error (1 fixed, 0 remaining).

$ python up008.py
4

Version

ruff 0.12.1 (32c5418 2025-06-26)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixesRelated to suggested fixes for violationshelp wantedContributions especially welcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions