Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Signature.bind allows certain positional-only parameters as keywords #130164

Closed
Labels
3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@dfremont

Description

@dfremont

Bug report

Bug description:

Prior to 3.13, the following code correctly raised aTypeError (I've tested 3.8-3.12, but see the last paragraph below):

deffun(x,/,**kwargs):passimportinspectsig=inspect.signature(fun)sig.bind(x=1)

In 3.13, the binding succeeds even though the positional-only parameter was passed as a keyword argument (of course,fun(x=1) fails with aTypeError).

As far as I can tell this bug hasn't been previously reported, although issue#107831 reportsinspect.getcallargs as having the same problem (prior to 3.13, unlike this bug).

I'm guessing the bug was introduced by#103404. If I try a version of 3.12 containing that patch (rather than the older versions I had installed previously), e.g. 3.12.9, it also exhibits the bug. It's possible that fixing the case where the positional-only parameter has a default value accidentally broke this case. Mentioning@jacobtylerwalls as the author of that PR in case they would like to take a look. Thanks!

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp