> The simplest fix is to operate on the dict directly rather than using > PyObject_SetAttrString on the module. It's a little ugly because the it > looks like that import code isn't limited to operating on modules. I > guess the patch would have to be something like > > if (PyModule_Check(mod)) { > PyObject *dict = PyModule_GetDict(mod); > if (!dict) { > Py_XDECREF(m); > m = NULL; > } > else if (PyDict_SetItemString(dict, subname, res) < 0) { > Py_XDECREF(m); > m = NULL; > } > } > else { > PyObject_SetAttrString(mod, subname, res) < 0) { > Py_XDECREF(m); > m = NULL; > } > } > > Ugly. Luckily that's the only PyObject_SetAttrString() in the import > code. But it sounds like a good idea to check this in. Please add a comment like /* Don't want to use PyObject_SetAttrString() because of warnings about overriding builtins when the submodule name happens to shadow a built-in */ --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4