Skip to content

w* format in PyArg_ParseTupleAndKeywords for optional argument #70614

Closed

Description

@VHalperin
mannequin
BPO 26427
Nosy @serhiy-storchaka
Superseder
  • bpo-23927: getargs.c skipitem() doesn't skip 'w*'
  • Files
  • getargs.c: Suggested update for Python 2.7.11
  • 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 2016-02-24.16:49:06.225>
    created_at = <Date 2016-02-24.14:46:26.316>
    labels = ['interpreter-core', 'type-bug']
    title = 'w* format in PyArg_ParseTupleAndKeywords for optional argument'
    updated_at = <Date 2016-02-24.16:49:06.223>
    user = 'https://bugs.python.org/VHalperin'

    bugs.python.org fields:

    activity = <Date 2016-02-24.16:49:06.223>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-02-24.16:49:06.225>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2016-02-24.14:46:26.316>
    creator = 'VHalperin'
    dependencies = []
    files = ['42021']
    hgrepos = []
    issue_num = 26427
    keywords = []
    message_count = 2.0
    messages = ['260807', '260819']
    nosy_count = 2.0
    nosy_names = ['serhiy.storchaka', 'VHalperin']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '23927'
    type = 'behavior'
    url = 'https://bugs.python.org/issue26427'
    versions = ['Python 2.7']

    Activity

    1. VHalperin commented on Feb 24, 2016

      VHalperinmannequin
      MannequinAuthor

      Two functions read the format string in Python/getargs.c: convertitem() for present arguments and skipitem() for missing ones. They must agree on the format; in fact, a comment to this effect is written right above convertitem(). Nevertheless, skipitem() only allows '*' modifier with 's' and 'z' formats, unlike convertitem(), that correctly processes 'w*'. As a result, 'w*' works if an array arguments is supplied, and fails if it is omitted. Suggested fix: add c == 'w' comparison to the line with *format == '*' in skipitem().

    2. added
      interpreter-core
      type-bug
      on Feb 24, 2016
    3. serhiy-storchaka commented on Feb 24, 2016

      @serhiy-storchaka
      Member

      This is a duplicate of bpo-23927.

    4. 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

      interpreter-coretype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions