This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Argument Clinic generates invalid code for optional parameter
Type: behavior Stage: commit review
Components: Build Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: larry Nosy List: georg.brandl, larry, python-dev, serhiy.storchaka
Priority: normal Keywords:

Created on 2014-01-08 21:17 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
larry.zero.positional.parameters.patch.1.txt larry, 2014-01-10 01:58 review
Messages (6)
msg207700 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-08 21:17
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.
msg207701 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-08 21:25
Good catch!  It should be an easy fix, but I won't be able to get to it until tomorrow.
msg207817 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-10 01:58
Here's a fix.  Works for me, let me know if it works for you.
msg207963 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-12 16:24
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
msg207968 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-01-12 16:49
New changeset 250b481a0d28 by Larry Hastings in branch 'default':
Issue #20196: Fixed a bug where Argument Clinic did not generate correct
http://hg.python.org/cpython/rev/250b481a0d28
msg207969 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-12 16:50
Easy fix.  Thanks for the report!
History
Date User Action Args
2022-04-11 14:57:56adminsetgithub: 64395
2014-01-12 16:50:39larrysetstatus: open -> closed
resolution: fixed
messages: + msg207969

stage: patch review -> commit review
2014-01-12 16:49:49python-devsetnosy: + python-dev
messages: + msg207968
2014-01-12 16:24:55larrysetnosy: + georg.brandl
messages: + msg207963
2014-01-10 01:58:16larrysetstage: needs patch -> patch review
2014-01-10 01:58:07larrysetfiles: + larry.zero.positional.parameters.patch.1.txt

messages: + msg207817
2014-01-09 07:28:42serhiy.storchakalinkissue20168 dependencies
2014-01-08 21:25:14larrysetassignee: larry
type: behavior
messages: + msg207701
stage: needs patch
2014-01-08 21:17:00serhiy.storchakacreate