Skip to content

Argument Clinic generates incorrect code for METH_METHOD methods without args #115015

Closed

Description

@erlend-aasland

Bug report

Argument Clinic generates incorrect code for methods without arguments, that need the defining class (METH_METHOD). Currently, only positional arguments are checked; any keyword argument is silently accepted. This affects methods in several extension modules (see PR).

See also a055dac.

Linked PRs

Activity

  1. added
    type-bug
    extension-modules
    3.11
    3.10 (EOL)
    3.12
    3.13
    on Feb 5, 2024
  2. added a commit that references this issue on Feb 5, 2024
  3. changed the title [-]Argument Clinic generated incorrect code for METH_METHOD methods without args[/-] [+]Argument Clinic generates incorrect code for METH_METHOD methods without args[/+] on Feb 5, 2024
  4. erlend-aasland commented on Feb 5, 2024

    @erlend-aasland
    ContributorAuthor

    Repro for ndbm:

    import dbm.ndbm
    db = dbm.ndbm("test", "c")
    db.keys(foo=1, bar=2)
  5. erlend-aasland commented on Feb 5, 2024

    @erlend-aasland
    ContributorAuthor

    FTR, this bug was introduced in 3.10, but I doubt this can be categorised as a security-fix, so this behaviour will probably remain in that version.

  6. encukou commented on Feb 5, 2024

    @encukou
    Member

    It's a bugfix, but it's also a backwards-incompatible change, and leaving the bug in wouldn't hurt very much.
    Consider only fixing it in main.

  7. erlend-aasland commented on Feb 5, 2024

    @erlend-aasland
    ContributorAuthor

    cc. 3.12 and 3.11 RMs, @Yhg1s and @pablogsal

  8. added a commit that references this issue on Feb 5, 2024
  9. erlend-aasland commented on Feb 5, 2024

    @erlend-aasland
    ContributorAuthor

    Keeping this open until there's a decision regarding backporting.

  10. pablogsal commented on Feb 5, 2024

    @pablogsal
    Member

    I don't mind backporting it but only if @Yhg1s agrees as I don't want 3.11 to have the fix but not 3.12

  11. added 3 commits that reference this issue on Feb 6, 2024
  12. encukou commented on Feb 12, 2024

    @encukou
    Member

    @serhiy-storchaka, did Thomas agree with the backports?

  13. serhiy-storchaka commented on Feb 12, 2024

    @serhiy-storchaka
    Member

    @encukou, it is an ordinary bugfix. A special permission is needed when we backport a feature or a bugfix that likely can break existing code.

  14. added a commit that references this issue on Feb 14, 2024
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

    3.10 (EOL)3.113.123.13extension-modulestopic-argument-clinictype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions