From: Guido van Rossum Date: Wed, 3 Apr 1991 19:06:26 +0000 (+0000) Subject: Moved get*doublearg() routines here from mathmodule.c X-Git-Tag: v0.9.8~1014 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7a904edcbf114924df0b15eb871d738834805bd5;p=thirdparty%2FPython%2Fcpython.git Moved get*doublearg() routines here from mathmodule.c --- diff --git a/Python/modsupport.c b/Python/modsupport.c index cf3e7b252e03..961310792b31 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); +}