[Python-Dev] Adding insint() function (original) (raw)

Andrew Kuchling akuchlin@mems-exchange.org
Fri, 18 Aug 2000 13:58:33 -0400


On Fri, Aug 18, 2000 at 01:52:20PM -0400, Tim Peters wrote:

+1, provided the treatment of errors is clearly documented.

The treatment of errors in module init functions seems to be simply charge ahead and do the inserts, and then do 'if (PyErr_Occurred()) Py_FatalError())'. The new function will probably return NULL if there's an error, but I doubt anyone will check it; it's too ungainly to write if ( (PyDict_SetItemStringInt(d, "foo", FOO)) == NULL || (PyDict_SetItemStringInt(d, "bar", BAR)) == NULL || ... repeat for 187 more constants ...

--amk