diff options
author | Fred Drake <fdrake@acm.org> | 2002-04-01 03:45:06 +0000 |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2002-04-01 03:45:06 +0000 |
commit | f4e3484692096260e0ea030f4f3490204fb966c6 (patch) | |
tree | 2a225afe9b1e28343e1b4a87dc1f6982ef569b8c /Modules/cmathmodule.c | |
parent | 7829335763ef520b909d657525f8a0a6e7b759db (diff) | |
download | cpython-git-f4e3484692096260e0ea030f4f3490204fb966c6.tar.gz |
Use the PyModule_*() API instead of manipulating the module dictionary
directly.
Diffstat (limited to 'Modules/cmathmodule.c')
-rw-r--r-- | Modules/cmathmodule.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c index 6e79680843..8e74e513b2 100644 --- a/Modules/cmathmodule.c +++ b/Modules/cmathmodule.c @@ -394,13 +394,11 @@ static PyMethodDef cmath_methods[] = { DL_EXPORT(void) initcmath(void) { - PyObject *m, *d, *v; + PyObject *m; m = Py_InitModule3("cmath", cmath_methods, module_doc); - d = PyModule_GetDict(m); - PyDict_SetItemString(d, "pi", - v = PyFloat_FromDouble(atan(1.0) * 4.0)); - Py_DECREF(v); - PyDict_SetItemString(d, "e", v = PyFloat_FromDouble(exp(1.0))); - Py_DECREF(v); + + PyModule_AddObject(m, "pi", + PyFloat_FromDouble(atan(1.0) * 4.0)); + PyModule_AddObject(m, "e", PyFloat_FromDouble(exp(1.0))); } |