Skip to content

Qualname should be used in function's TypeErrors #4473

@nicku12345

Description

@nicku12345

Feature

Running the two code snippets below in CPython and in RustPython give different results

Example 1

def f(a, /, b=0): pass
f.__qualname__ = "g"
f(a=1, b=0)

In CPython:

TypeError: g() got some positional-only arguments passed as keyword arguments: 'a'

In RustPython:

TypeError: f() got some positional-only arguments passed as keyword arguments: 'a'

Example 2

class A:
    def f(self, a, /, b=0): pass

A().f(a=1, b=0)

In CPython:

TypeError: A.f() got some positional-only arguments passed as keyword arguments: 'a'

In RustPython:

TypeError: f() got some positional-only arguments passed as keyword arguments: 'a'

Python Documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions