Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed97f6a commit 738d4ddCopy full SHA for 738d4dd
1 file changed
Modules/mathmodule.c
@@ -150,18 +150,9 @@ void
150
initmath()
151
{
152
object *m, *d, *v;
153
- struct methodlist *ml;
154
- if ((m = new_module("math")) == NULL)
155
- fatal("can't create math module");
+
+ m = initmodule("math", math_methods);
156
d = getmoduledict(m);
157
- for (ml = math_methods; ml->ml_name != NULL; ml++) {
158
- v = newmethodobject(ml->ml_name, ml->ml_meth, (object *)NULL);
159
- if (v == NULL || dictinsert(d, ml->ml_name, v) != 0) {
160
- fatal("can't initialize math module");
161
- }
162
- DECREF(v);
163
164
dictinsert(d, "pi", newfloatobject(atan(1.0) * 4.0));
165
dictinsert(d, "e", newfloatobject(exp(1.0)));
166
- DECREF(m);
167
}
0 commit comments