bpo-33829: provide new object protocol helper for C API#7625
bpo-33829: provide new object protocol helper for C API#7625brgl wants to merge 1 commit intopython:masterfrom
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. When your account is ready, please add a comment in this pull request Thanks again for your contribution, we look forward to reviewing it! |
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(). This patch proposes to wrap the two calls in a new helper.
27e2c7a to
ffc3e25
Compare
|
CLA is now signed. |
| { | ||
| PyObject *callable, *retval; | ||
|
|
||
| if (obj == NULL) |
There was a problem hiding this comment.
Please, use braces as indicated in pep 7: https://www.python.org/dev/peps/pep-0007/
| return null_error(); | ||
|
|
||
| callable = PyObject_GetAttrString(obj, name); | ||
| if (callable == NULL) |
|
Also, it seems that core developers are not sure that this change is needed. Can you discuss with them in the issue? Thanks! :) |
|
Closing this pull request as the bug tracker issue was rejected. |
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().
This patch proposes to wrap the two calls in a new helper.
https://bugs.python.org/issue33829