[3.8] bpo-37942: Improve argument clinic float converter (GH-15470) (GH-15480)
(cherry picked from commit aef9ad82f7f667cd001a7112d3bc636e918626f7)
diff --git a/Python/clinic/sysmodule.c.h b/Python/clinic/sysmodule.c.h
index 6f248ff..563332e 100644
--- a/Python/clinic/sysmodule.c.h
+++ b/Python/clinic/sysmodule.c.h
@@ -362,9 +362,15 @@
PyObject *return_value = NULL;
double interval;
- interval = PyFloat_AsDouble(arg);
- if (PyErr_Occurred()) {
- goto exit;
+ if (PyFloat_CheckExact(arg)) {
+ interval = PyFloat_AS_DOUBLE(arg);
+ }
+ else
+ {
+ interval = PyFloat_AsDouble(arg);
+ if (interval == -1.0 && PyErr_Occurred()) {
+ goto exit;
+ }
}
return_value = sys_setswitchinterval_impl(module, interval);
@@ -1082,4 +1088,4 @@
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
#define SYS_GETANDROIDAPILEVEL_METHODDEF
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
-/*[clinic end generated code: output=43c4fde7b5783d8d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1a67b37c4486d65f input=a9049054013a1b77]*/