Skip to content

Properly Handle Duplicate Kwargs #2963

Description

@joshuahaertel
def print_kwargs(**kwargs):
    print(kwargs)

print_kwargs(**{'a': 'a', 'a': 'b'})

This works in python, but not when compiled with Cython. I think it might have something to do with the way kwargs are unpacked.

It's good to point out that this is illegal in python, and will raise a SyntaxError(keyword argument repeated):
print_kwargs(a='a', a='b')

Also worth pointing out that, Interestingly enough, this works the same in python as in cython:
print({'a': 'a', 'a': 'b'})
printing {'a': 'b'}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions