summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-04-03 19:06:26 (GMT)
committerGuido van Rossum <guido@python.org>1991-04-03 19:06:26 (GMT)
commit7a904edcbf114924df0b15eb871d738834805bd5 (patch)
tree486803c23133f011555aa51306ceecc40fd188b3 /Python
parent5b7f945bc3e86d26b7570d1dbc54f8012ba19d88 (diff)
downloadcpython-7a904edcbf114924df0b15eb871d738834805bd5.zip
cpython-7a904edcbf114924df0b15eb871d738834805bd5.tar.gz
cpython-7a904edcbf114924df0b15eb871d738834805bd5.tar.bz2
Moved get*doublearg() routines here from mathmodule.c
Diffstat (limited to 'Python')
-rw-r--r--Python/modsupport.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c
index cf3e7b2..9613107 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -379,3 +379,32 @@ getshortlistarg(args, a, n)
}
return 1;
}
+
+int
+getdoublearg(args, px)
+ register object *args;
+ double *px;
+{
+ if (args == NULL)
+ return err_badarg();
+ if (is_floatobject(args)) {
+ *px = getfloatvalue(args);
+ return 1;
+ }
+ if (is_intobject(args)) {
+ *px = getintvalue(args);
+ return 1;
+ }
+ return err_badarg();
+}
+
+int
+get2doublearg(args, px, py)
+ register object *args;
+ double *px, *py;
+{
+ if (args == NULL || !is_tupleobject(args) || gettuplesize(args) != 2)
+ return err_badarg();
+ return getdoublearg(gettupleitem(args, 0), px) &&
+ getdoublearg(gettupleitem(args, 1), py);
+}