Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Object/classobject.c to Argument Clinic #91098

Closed
arhadthedev opened this issue Mar 7, 2022 · 1 comment · Fixed by #31711
Closed

Convert Object/classobject.c to Argument Clinic #91098

arhadthedev opened this issue Mar 7, 2022 · 1 comment · Fixed by #31711
Labels
3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@arhadthedev
Copy link
Member

BPO 46942
Nosy @arhadthedev
PRs
  • gh-91098: Use Argument Clinic for Object/classobject.c to fix docstrings #31711
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2022-03-07.08:50:35.484>
    labels = ['interpreter-core', 'type-feature', '3.11']
    title = 'Convert Object/classobject.c to Argument Clinic'
    updated_at = <Date 2022-03-07.08:50:47.992>
    user = 'https://github.com/arhadthedev'

    bugs.python.org fields:

    activity = <Date 2022-03-07.08:50:47.992>
    actor = 'arhadthedev'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2022-03-07.08:50:35.484>
    creator = 'arhadthedev'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46942
    keywords = ['patch']
    message_count = 1.0
    messages = ['414643']
    nosy_count = 1.0
    nosy_names = ['arhadthedev']
    pr_nums = ['31711']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue46942'
    versions = ['Python 3.11']

    @arhadthedev
    Copy link
    Member Author

    • Convert method.__reduce__, method.__new__, and instancemethod.__new__ to AC. It looks like nothing else can be converted in classobject.c.

      This is my first time working with AC so I could make some mistakes.

    • Fix found mismatches in method.__new__ where docstring and implementation diverged:

      • on how to name arguments (function vs func, instance vs self) - fuct is a semi-abbreviation and self is a special argument of instance methods. No compatibility is harmed because these arguments were forced to be positional-only anyway with if (!_PyArg_NoKeywords("method", kw)) return NULL;.

      • on whether args are positional (the implementation called _PyArg_NoKeywords) or not (the documentation and Lib/idlelib/idle_test/test_calltip.py:80) - align with other assertions in test_builtins() that have reference docstrings with both / marker and a proper description.

    Minor refactoring:

    • Since PyMethod_Type and PyInstanceMethod_Type are modified anyway, transform their initialization to C99-style.

    • Change a disabler for PyInstanceMethod_Type.tp_hash from comments to #if 0.

    @arhadthedev arhadthedev added 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement labels Mar 7, 2022
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    JelleZijlstra added a commit that referenced this issue Apr 19, 2022
    …ngs (#31711)
    
    Closes GH-91098.
    
    Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
    Projects
    None yet
    Development

    Successfully merging a pull request may close this issue.

    1 participant