Skip to content

Argument Clinic generates invalid code for optional parameter #64395

Description

@serhiy-storchaka
BPO 20196
Nosy @birkenfeld, @larryhastings, @serhiy-storchaka
Files
  • larry.zero.positional.parameters.patch.1.txt
  • 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 = 'https://github.com/larryhastings'
    closed_at = <Date 2014-01-12.16:50:39.144>
    created_at = <Date 2014-01-08.21:17:00.519>
    labels = ['type-bug', 'build']
    title = 'Argument Clinic generates invalid code for optional parameter'
    updated_at = <Date 2014-01-12.16:50:39.143>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2014-01-12.16:50:39.143>
    actor = 'larry'
    assignee = 'larry'
    closed = True
    closed_date = <Date 2014-01-12.16:50:39.144>
    closer = 'larry'
    components = ['Build']
    creation = <Date 2014-01-08.21:17:00.519>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['33397']
    hgrepos = []
    issue_num = 20196
    keywords = []
    message_count = 6.0
    messages = ['207700', '207701', '207817', '207963', '207968', '207969']
    nosy_count = 4.0
    nosy_names = ['georg.brandl', 'larry', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'commit review'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue20196'
    versions = ['Python 3.4']

    Activity

    1. serhiy-storchaka commented on Jan 8, 2014

      @serhiy-storchaka
      MemberAuthor

      Argument Clinic generates invalid code for optional parameter if there are no mandatory parameters except self. Example:

      /*[clinic input]
      zlib.Decompress.flush

      self: self(type="compobject *")
      [
      length: uint
          the initial size of the output buffer.
      ]
      /
      

      Return a bytes object containing any remaining decompressed data.
      [clinic start generated code]*/

      Generates:

      ...
          switch (PyTuple_Size(args)) {
              case 0:
                  if (!PyArg_ParseTuple(args, ":flush", ))
                      return NULL;
                  break;
      ...

      Note a comma in PyArg_ParseTuple.

    2. larryhastings commented on Jan 8, 2014

      @larryhastings
      Contributor

      Good catch! It should be an easy fix, but I won't be able to get to it until tomorrow.

    3. self-assigned this
      on Jan 8, 2014
    4. larryhastings commented on Jan 10, 2014

      @larryhastings
      Contributor

      Here's a fix. Works for me, let me know if it works for you.

    5. larryhastings commented on Jan 12, 2014

      @larryhastings
      Contributor

      Georg, you mind reviewing this too? Six line patch. Just trying to clean my plate a little before I fix a bug for you :D

    6. python-dev commented on Jan 12, 2014

      python-devmannequin
      Mannequin

      New changeset 250b481a0d28 by Larry Hastings in branch 'default':
      Issue bpo-20196: Fixed a bug where Argument Clinic did not generate correct
      http://hg.python.org/cpython/rev/250b481a0d28

    7. larryhastings commented on Jan 12, 2014

      @larryhastings
      Contributor

      Easy fix. Thanks for the report!

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

    Labels

    buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions