Skip to content

Argument Clinic: add common converter to Py_ssize_t that accepts None #74038

Closed

Description

@serhiy-storchaka
BPO 29852
Nosy @larryhastings, @benjaminp, @serhiy-storchaka
PRs
  • bpo-29852: Argument Clinic Py_ssize_t converter now supports None #716
  • 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 = <Date 2017-03-30.06:20:11.284>
    created_at = <Date 2017-03-19.11:28:47.126>
    labels = ['type-feature', '3.7', 'expert-argument-clinic', 'expert-IO']
    title = 'Argument Clinic: add common converter to Py_ssize_t that accepts None'
    updated_at = <Date 2017-03-30.06:20:11.284>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2017-03-30.06:20:11.284>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-03-30.06:20:11.284>
    closer = 'serhiy.storchaka'
    components = ['IO', 'Argument Clinic']
    creation = <Date 2017-03-19.11:28:47.126>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 29852
    keywords = []
    message_count = 2.0
    messages = ['289847', '290821']
    nosy_count = 4.0
    nosy_names = ['larry', 'benjamin.peterson', 'stutzbach', 'serhiy.storchaka']
    pr_nums = ['716']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue29852'
    versions = ['Python 3.7']

    Activity

    1. serhiy-storchaka commented on Mar 19, 2017

      @serhiy-storchaka
      MemberAuthor

      Many methods in the io module accept int and None and convert the argument to Py_ssize_t. Proposed patch adds common Argument Clinic converter for that case. The Py_ssize_t converter now takes the accept argument that can be {int} (the default) or {int, NoneType}. In the latter case None is acceptable value which means using the default value.

      Similar converter was previously used locally in the io module, now it is used also in the mmap module.

      Examples:

      _io.BytesIO.read
      size: Py_ssize_t(accept={int, NoneType}) = -1
      /

      _io.BytesIO.truncate
      size: Py_ssize_t(accept={int, NoneType}, c_default="self->pos") = None
      /

    2. serhiy-storchaka commented on Mar 30, 2017

      @serhiy-storchaka
      MemberAuthor

      New changeset 762bf40 by Serhiy Storchaka in branch 'master':
      bpo-29852: Argument Clinic Py_ssize_t converter now supports None (#716)
      762bf40

    3. transferred this issue fromon Apr 10, 2022
    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.7 (EOL)topic-IOtopic-argument-clinictype-feature

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions