classification
Title: Argument Clinic incorrectly works with custom converter and renamed parameter
Type: behavior Stage: resolved
Components: Argument Clinic Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: larry, serhiy.storchaka
Priority: normal Keywords:

Created on 2016-05-01 18:45 by serhiy.storchaka, last changed 2016-05-02 08:33 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
issue26902_sample.c serhiy.storchaka, 2016-05-01 18:47
Messages (3)
msg264606 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-01 18:45
Argument Clinic uses original name of Python parameter in generated code for custom (format code "O&") converter even if the parameter was renamed.

Example:

/*[clinic input]
test
    filename as path: object(converter="PyUnicode_FSConverter")
    /
[clinic start generated code]*/

Generated code:

static PyObject *
test(PyModuleDef *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    PyObject *path;

    if (!PyUnicode_FSConverter(arg, &filename))
        goto exit;
    return_value = test_impl(module, path);

exit:
    return return_value;
}
msg264627 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2016-05-02 06:39
This is caused by your "meth_o inline" code, which isn't checked in yet.  A clean checkout of CPython trunk generates this correct code:

    if (!PyArg_Parse(arg, "O&:test", PyUnicode_FSConverter, &path))

Maybe you don't need to use bugs.python.org as your personal bug tracker; maybe you don't need to add me to your private bugs.
msg264630 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-02 08:33
You are right. Sorry for the noise.
History
Date User Action Args
2016-05-02 08:33:16serhiy.storchakasetmessages: + msg264630
2016-05-02 06:39:29larrysetstatus: open -> closed
resolution: not a bug
messages: + msg264627

stage: resolved
2016-05-01 18:49:25serhiy.storchakasettitle: Argument Clinic incorrectly work with custom converter and renamed parameter -> Argument Clinic incorrectly works with custom converter and renamed parameter
2016-05-01 18:49:00serhiy.storchakalinkissue23867 dependencies
2016-05-01 18:47:29serhiy.storchakasetfiles: + issue26902_sample.c
2016-05-01 18:45:28serhiy.storchakacreate