Issue33829
Created on 2018-06-11 09:54 by Bartosz Gołaszewski, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 7625 | closed | python-dev, 2018-06-11 09:57 | |
| Messages (5) | |||
|---|---|---|---|
| msg319288 - (view) | Author: Bartosz Gołaszewski (Bartosz Gołaszewski) * | Date: 2018-06-11 09:54 | |
If we want to call an object's method from C code and pass it the args and kwargs tuples unchanged, we need to first retrieve the callable object using PyObject_GetAttrString(), then call it using PyObject_Call(). I would like to propose wrapping the two calls in a new helper. |
|||
| msg319289 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-06-11 10:19 | |
Is this case common enough for adding special API? The name PyObject_CallMethodArgs looks too similar to the existing name PyObject_CallMethodObjArgs, this will make confusion. If add an API that accepts the method name as C string, you need to add also an API for method name passed as Python string and a private API for method name passed as `struct _Py_Identifier *`. Adding new API has a non-zero cost. It adds maintenance burden for core developers, it increases the number of things that should be learned by users, and can leads to generating less optimal code by the compiler, because it will need to analyze more code in the same file, and it can optimize less common paths and left more common paths unoptimized. Are you aware that you can pass the args tuple unchanged by using PyObject_CallMethod()? PyObject_CallMethod(obj, name, "O", args) |
|||
| msg319296 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2018-06-11 11:34 | |
> PyObject_CallMethodArgs(PyObject *obj, const char *name, PyObject *args, PyObject *kwargs) This API is not efficient. It requires to create a temporary tuple and dictionary to pass position and keyword arguments. Look at FASTCALL which has a very different API. Sadly, FASTCALL APIs are currently private. |
|||
| msg342777 - (view) | Author: Cheryl Sabella (cheryl.sabella) * ![]() |
Date: 2019-05-17 23:54 | |
It seems that this issue is languishing without any additional comments from the OP. Should it be closed as rejected? Thanks! |
|||
| msg349048 - (view) | Author: Jeroen Demeyer (jdemeyer) * ![]() |
Date: 2019-08-05 12:13 | |
I agree with rejecting and closing this issue. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:01 | admin | set | github: 78010 |
| 2019-08-05 12:51:57 | serhiy.storchaka | set | status: open -> closed resolution: rejected stage: patch review -> resolved |
| 2019-08-05 12:13:55 | jdemeyer | set | nosy:
+ jdemeyer messages: + msg349048 |
| 2019-05-17 23:54:42 | cheryl.sabella | set | nosy:
+ cheryl.sabella messages: + msg342777 |
| 2018-06-14 13:56:08 | pablogsal | set | nosy:
+ pablogsal |
| 2018-06-11 11:34:08 | vstinner | set | messages: + msg319296 |
| 2018-06-11 10:19:00 | serhiy.storchaka | set | nosy:
+ vstinner, serhiy.storchaka messages: + msg319289 |
| 2018-06-11 09:57:33 | python-dev | set | keywords:
+ patch stage: patch review pull_requests: + pull_request7244 |
| 2018-06-11 09:54:30 | Bartosz Gołaszewski | create | |

