Skip to content

NotImplementedError: Predefining a positional-only argument using keyword is not supported #107

@smarie

Description

@smarie

It seems that since python 3.12.4 (or .1, or .2, or .3 but it was not the case in 3.12.0),

def f(a, b, c, /, *, d, **e):
    return a + b + c + d + sum(e)

# it is possible to keyword-partialize a positional-only argument...
fp_ref = functools.partial(f, b=0)

# but 'signature' does not support it !
if sys.version_info < (3, 12, 4):
    signature(fp_ref)   # <--   raises(ValueError) !!!!
else:
    # Now it works !
    assert str(signature(fp_ref)) == "(a, c, /, *, d, **e)"

# On our end, we used to not support it because signature was not supporting it
makefun.partial(f, b=0)  # Raises `NotImplementedError`

Details: raises NotImplementedError: Predefining a positional-only argument using keyword is not supported as in python 3.8.8, 'signature()' does not support such functions and raises a ValueError

We should probably implement it now

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions