summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-01-04 19:12:13 (GMT)
committerGuido van Rossum <guido@python.org>1995-01-04 19:12:13 (GMT)
commit6d023c98b06e8b4558f3558335433f371a89cc9b (patch)
tree9a1b3cb88da4ef20e5a3cbb2e676845ca85e3d78 /Python/bltinmodule.c
parent524b588553afb0759c5be590a7aa41db92dcd2ae (diff)
downloadcpython-6d023c98b06e8b4558f3558335433f371a89cc9b.zip
cpython-6d023c98b06e8b4558f3558335433f371a89cc9b.tar.gz
cpython-6d023c98b06e8b4558f3558335433f371a89cc9b.tar.bz2
Added 1995 to copyright message.
bltinmodule.c: fixed coerce() nightmare in ternary pow(). modsupport.c (initmodule2): pass METH_FREENAME flag to newmethodobject(). pythonrun.c: move flushline() into and around print_error().
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 39dcc41..c553be6 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1,6 +1,6 @@
/***********************************************************
-Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
-Amsterdam, The Netherlands.
+Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
+The Netherlands.
All Rights Reserved
@@ -922,16 +922,31 @@ builtin_pow(self, args)
}
if (coerce(&v, &w) != 0)
return NULL;
- if (z!=None) {
- if (coerce(&w, &z) != 0)
- return NULL;
- if (coerce(&v, &z) != 0)
- return NULL;
+ if (z == None) {
+ x = (*v->ob_type->tp_as_number->nb_power)(v, w, z);
+ }
+ else {
+ object *v1, *z1, *w2, *z2;
+ x = NULL;
+ v1 = v;
+ z1 = z;
+ if (coerce(&v1, &z1) != 0)
+ goto error2;
+ w2 = w;
+ z2 = z1;
+ if (coerce(&w2, &z2) != 0)
+ goto error1;
+ x = (*v1->ob_type->tp_as_number->nb_power)(v1, w2, z2);
+ DECREF(w2);
+ DECREF(z2);
+ error1:
+ DECREF(v1);
+ DECREF(z1);
+ error2:
+ ;
}
- x = (*v->ob_type->tp_as_number->nb_power)(v, w, z);
DECREF(v);
DECREF(w);
- if (z!=None) {DECREF(w); DECREF(v); DECREF(z); DECREF(z);}
return x;
}