classification
Title: Argument Clinic doesn't handle module level functions with module parameter well
Type: behavior Stage: resolved
Components: Demos and Tools Versions: Python 3.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: larry, serhiy.storchaka, zach.ware
Priority: normal Keywords:

Created on 2014-01-25 08:53 by serhiy.storchaka, last changed 2014-01-25 10:53 by larry. This issue is now closed.

Messages (7)
msg209166 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-25 08:53
Argument Clinic generates wrong signature for module level functions.

For example for the following declaration

/*[clinic input]
binascii.a2b_uu

    ascii: ascii_buffer
    /

Decode a line of uuencoded data.
[clinic start generated code]*/

Argument Clinic generates

PyDoc_STRVAR(binascii_a2b_uu__doc__,
"a2b_uu(module, ascii)\n"
"Decode a line of uuencoded data.");
msg209167 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-01-25 08:55
That's by design (of #20189); inspect.Signature.from_builtin strips out the 'module' param.
msg209169 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-25 09:00
What if function already has the "module" parameter? E.g. _warnings.warn_explicit.
msg209171 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-01-25 09:06
Ahh, that is a good point, though the real problem with that is in compilation rather than the Python signature.  I believe there's a fix in the works, somewhere in Larry's to-do list.  _winapi also has a function that takes a 'module' parameter, though being undocumented (and referring to a handle, not a Python module), I was able to just name that one 'module_handle'.
msg209178 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-25 09:40
If you use a self converter you can name your first parameter anything you like.
msg209182 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-25 10:06
So, are you still claiming there's a bug here?  Or can we close this?
msg209188 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-25 10:51
Well, if originally reported behavior is by design, and there is other open issue for the "module" parameter, we can close this.
History
Date User Action Args
2014-01-25 10:53:17larrysetstatus: open -> closed
resolution: not a bug
stage: resolved
2014-01-25 10:51:59serhiy.storchakasetmessages: + msg209188
2014-01-25 10:06:31larrysetmessages: + msg209182
2014-01-25 10:00:29serhiy.storchakaunlinkissue20151 dependencies
2014-01-25 09:40:09larrysetmessages: + msg209178
2014-01-25 09:06:56zach.waresetresolution: not a bug -> (no value)
messages: + msg209171
title: Argument Clinic generates wrong signature for module level functions -> Argument Clinic doesn't handle module level functions with module parameter well
2014-01-25 09:00:17serhiy.storchakasetstatus: pending -> open

messages: + msg209169
2014-01-25 08:55:27zach.waresetstatus: open -> pending

nosy: + zach.ware
messages: + msg209167

resolution: not a bug
2014-01-25 08:53:48serhiy.storchakalinkissue20151 dependencies
2014-01-25 08:53:27serhiy.storchakacreate