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().
This commit is contained in:
parent
524b588553
commit
6d023c98b0
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
@ -922,16 +922,31 @@ builtin_pow(self, args)
|
||||||
}
|
}
|
||||||
if (coerce(&v, &w) != 0)
|
if (coerce(&v, &w) != 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (z!=None) {
|
if (z == None) {
|
||||||
if (coerce(&w, &z) != 0)
|
x = (*v->ob_type->tp_as_number->nb_power)(v, w, z);
|
||||||
return NULL;
|
}
|
||||||
if (coerce(&v, &z) != 0)
|
else {
|
||||||
return NULL;
|
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(v);
|
||||||
DECREF(w);
|
DECREF(w);
|
||||||
if (z!=None) {DECREF(w); DECREF(v); DECREF(z); DECREF(z);}
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
@ -58,8 +58,9 @@ initmodule2(name, methods, passthrough)
|
||||||
fatal("out of mem for method name");
|
fatal("out of mem for method name");
|
||||||
sprintf(namebuf, "%s.%s", name, ml->ml_name);
|
sprintf(namebuf, "%s.%s", name, ml->ml_name);
|
||||||
v = newmethodobject(namebuf, ml->ml_meth,
|
v = newmethodobject(namebuf, ml->ml_meth,
|
||||||
(object *)passthrough, ml->ml_varargs);
|
(object *)passthrough,
|
||||||
/* XXX The malloc'ed memory in namebuf is never freed */
|
(ml->ml_varargs ? METH_VARARGS : 0) |
|
||||||
|
METH_FREENAME);
|
||||||
if (v == NULL || dictinsert(d, ml->ml_name, v) != 0) {
|
if (v == NULL || dictinsert(d, ml->ml_name, v) != 0) {
|
||||||
fprintf(stderr, "initializing module: %s\n", name);
|
fprintf(stderr, "initializing module: %s\n", name);
|
||||||
fatal("can't initialize module");
|
fatal("can't initialize module");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
@ -178,12 +178,12 @@ run_tty_1(fp, filename)
|
||||||
return -1;
|
return -1;
|
||||||
d = getmoduledict(m);
|
d = getmoduledict(m);
|
||||||
v = run_node(n, filename, d, d);
|
v = run_node(n, filename, d, d);
|
||||||
flushline();
|
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
print_error();
|
print_error();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
DECREF(v);
|
DECREF(v);
|
||||||
|
flushline();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,12 +211,12 @@ run_script(fp, filename)
|
||||||
} else {
|
} else {
|
||||||
v = run_file(fp, filename, file_input, d, d);
|
v = run_file(fp, filename, file_input, d, d);
|
||||||
}
|
}
|
||||||
flushline();
|
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
print_error();
|
print_error();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
DECREF(v);
|
DECREF(v);
|
||||||
|
flushline();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,12 +230,12 @@ run_command(command)
|
||||||
return -1;
|
return -1;
|
||||||
d = getmoduledict(m);
|
d = getmoduledict(m);
|
||||||
v = run_string(command, file_input, d, d);
|
v = run_string(command, file_input, d, d);
|
||||||
flushline();
|
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
print_error();
|
print_error();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
DECREF(v);
|
DECREF(v);
|
||||||
|
flushline();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,6 +244,7 @@ print_error()
|
||||||
{
|
{
|
||||||
object *exception, *v, *tb, *f;
|
object *exception, *v, *tb, *f;
|
||||||
err_fetch(&exception, &v, &tb);
|
err_fetch(&exception, &v, &tb);
|
||||||
|
flushline();
|
||||||
if (exception == NULL)
|
if (exception == NULL)
|
||||||
fatal("print_error called but no exception");
|
fatal("print_error called but no exception");
|
||||||
if (exception == SystemExit) {
|
if (exception == SystemExit) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue