Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
It is common (more than 30 cases) in the C code to access a function or a variable from other module. For example:
functools=PyImport_ImportModule("functools");if (!functools) gotoerror;st->partial=PyObject_GetAttrString(functools,"partial");Py_CLEAR(functools);
I propose to add a private helper function which combinesPyImport_ImportModule() andPyObject_GetAttrString().
st->partial=_PyImport_GetModuleAttrString("functools","partial");
It will save 4-6 lines of code and a variable on every use.