summaryrefslogtreecommitdiff
path: root/Modules/clinic/_statisticsmodule.c.h
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2019-08-24 19:10:39 -0700
committerGitHub <noreply@github.com>2019-08-24 19:10:39 -0700
commitaef9ad82f7f667cd001a7112d3bc636e918626f7 (patch)
tree71bc842de3236a77c6084e951ecf6061693705c0 /Modules/clinic/_statisticsmodule.c.h
parent805f8f9afea116c5d4d000570e3d02ae84502f43 (diff)
downloadcpython-git-aef9ad82f7f667cd001a7112d3bc636e918626f7.tar.gz
bpo-37942: Improve argument clinic float converter (GH-15470)
Diffstat (limited to 'Modules/clinic/_statisticsmodule.c.h')
-rw-r--r--Modules/clinic/_statisticsmodule.c.h38
1 files changed, 28 insertions, 10 deletions
diff --git a/Modules/clinic/_statisticsmodule.c.h b/Modules/clinic/_statisticsmodule.c.h
index f5a2e4678f..5ff01efddc 100644
--- a/Modules/clinic/_statisticsmodule.c.h
+++ b/Modules/clinic/_statisticsmodule.c.h
@@ -26,17 +26,35 @@ _statistics__normal_dist_inv_cdf(PyObject *module, PyObject *const *args, Py_ssi
if (!_PyArg_CheckPositional("_normal_dist_inv_cdf", nargs, 3, 3)) {
goto exit;
}
- p = PyFloat_AsDouble(args[0]);
- if (PyErr_Occurred()) {
- goto exit;
+ if (PyFloat_CheckExact(args[0])) {
+ p = PyFloat_AS_DOUBLE(args[0]);
}
- mu = PyFloat_AsDouble(args[1]);
- if (PyErr_Occurred()) {
- goto exit;
+ else
+ {
+ p = PyFloat_AsDouble(args[0]);
+ if (p == -1.0 && PyErr_Occurred()) {
+ goto exit;
+ }
}
- sigma = PyFloat_AsDouble(args[2]);
- if (PyErr_Occurred()) {
- goto exit;
+ if (PyFloat_CheckExact(args[1])) {
+ mu = PyFloat_AS_DOUBLE(args[1]);
+ }
+ else
+ {
+ mu = PyFloat_AsDouble(args[1]);
+ if (mu == -1.0 && PyErr_Occurred()) {
+ goto exit;
+ }
+ }
+ if (PyFloat_CheckExact(args[2])) {
+ sigma = PyFloat_AS_DOUBLE(args[2]);
+ }
+ else
+ {
+ sigma = PyFloat_AsDouble(args[2]);
+ if (sigma == -1.0 && PyErr_Occurred()) {
+ goto exit;
+ }
}
_return_value = _statistics__normal_dist_inv_cdf_impl(module, p, mu, sigma);
if ((_return_value == -1.0) && PyErr_Occurred()) {
@@ -47,4 +65,4 @@ _statistics__normal_dist_inv_cdf(PyObject *module, PyObject *const *args, Py_ssi
exit:
return return_value;
}
-/*[clinic end generated code: output=ba6af124acd34732 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c5826928a238326c input=a9049054013a1b77]*/