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.
Created on 2015年04月24日 13:48 by serhiy.storchaka, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (6) | |||
|---|---|---|---|
| msg241943 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2015年04月24日 13:48 | |
Argument Clinic no longer works single optional argument. For example see _tkinter.tkapp.wantobjects in the patch in issue20168. /*[clinic input] _tkinter.tkapp.wantobjects [ value: int ] / [clinic start generated code]*/ It is converted to the methoddef of type METH_O. #define _TKINTER_TKAPP_WANTOBJECTS_METHODDEF \ {"wantobjects", (PyCFunction)_tkinter_tkapp_wantobjects, METH_O, _tkinter_tkapp_wantobjects__doc__}, static PyObject * _tkinter_tkapp_wantobjects(PyObject *self, PyObject *arg) { PyObject *return_value = NULL; int group_right_1 = 0; int value = 0; if (!PyArg_Parse(arg, "i:wantobjects", &value)) goto exit; return_value = _tkinter_tkapp_wantobjects_impl(self, group_right_1, value); exit: return return_value; } As result wantobjects() can't be called without an argument. |
|||
| msg242500 - (view) | Author: Larry Hastings (larry) * (Python committer) | Date: 2015年05月03日 18:56 | |
Optional groups were designed to support two specific legacy use cases: * functions that have groups of parameters that are * functions with optional parameters to the left of required parameters They are not intended to be used in cases like this. I really, really wish you would stop using them except for these specific legacy cases. Furthermore, the argument parsing for tkinter.tkapp.wantobjects has a very clear translation into Argument Clinic: value: int = -1 / Optional groups should not be used for single-argument functions. I have no interest in fixing this bug. |
|||
| msg242501 - (view) | Author: Larry Hastings (larry) * (Python committer) | Date: 2015年05月03日 18:59 | |
Sorry, I forgot to finish the first bullet point. It should have read: * functions that have groups of parameters that are optional only as a group (e.g. curses.window.getch) |
|||
| msg242515 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2015年05月03日 20:11 | |
Then it would be better to not convert wantobjects() to Argument Clinic. Using -1 as a value for not passed argument is a hack (added in 1ab9978123be) and I don't want to propagate it to the signature. But I afraid that there are other functions that suffer from this bug (may be in the curses module). |
|||
| msg242516 - (view) | Author: Larry Hastings (larry) * (Python committer) | Date: 2015年05月03日 20:14 | |
If the argument currently uses a default value of -1, then I see no problem with converting it to Argument Clinic using a default value of -1. If you claim it's a "hack" then you should discuss that with the author of 1ab9978123be. |
|||
| msg242517 - (view) | Author: Larry Hastings (larry) * (Python committer) | Date: 2015年05月03日 20:14 | |
Closing as wontfix. This is not a supported use of optional groups. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:16 | admin | set | github: 68239 |
| 2015年05月03日 20:14:52 | larry | set | status: languishing -> closed resolution: wont fix messages: + msg242517 |
| 2015年05月03日 20:14:20 | larry | set | messages: + msg242516 |
| 2015年05月03日 20:11:23 | serhiy.storchaka | set | status: open -> languishing messages: + msg242515 |
| 2015年05月03日 18:59:29 | larry | set | messages: + msg242501 |
| 2015年05月03日 18:56:08 | larry | set | messages: + msg242500 |
| 2015年05月03日 14:31:49 | serhiy.storchaka | unlink | issue20168 dependencies |
| 2015年04月24日 13:49:13 | serhiy.storchaka | link | issue20168 dependencies |
| 2015年04月24日 13:48:50 | serhiy.storchaka | create | |