Mercurial > cpython-lru_cache-weakref
diff Modules/mathmodule.c @ 4752:7367fb107108 legacy-trunk
Better error checking in initmath().
| author | Barry Warsaw <barry@python.org> |
|---|---|
| date | Tue, 17 Dec 1996 00:47:03 +0000 |
| parents | 49745ddb4f69 |
| children | f8b36c0ec114 |
line wrap: on
line diff
--- a/Modules/mathmodule.c Tue Dec 17 00:05:22 1996 +0000 +++ b/Modules/mathmodule.c Tue Dec 17 00:47:03 1996 +0000 @@ -242,8 +242,19 @@ m = Py_InitModule("math", math_methods); d = PyModule_GetDict(m); - PyDict_SetItemString(d, "pi", v = PyFloat_FromDouble(atan(1.0) * 4.0)); + + if (!(v = PyFloat_FromDouble(atan(1.0) * 4.0))) + goto finally; + if (PyDict_SetItemString(d, "pi", v) < 0) + goto finally; Py_DECREF(v); - PyDict_SetItemString(d, "e", v = PyFloat_FromDouble(exp(1.0))); + + if (!(v = PyFloat_FromDouble(exp(1.0)))) + goto finally; + if (PyDict_SetItemString(d, "e", ) < 0) + goto finally; Py_DECREF(v); + + finally: + Py_FatalError("can't initialize math module"); }
