summaryrefslogtreecommitdiff
path: root/Objects/clinic/floatobject.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/clinic/floatobject.c.h')
-rw-r--r--Objects/clinic/floatobject.c.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/Objects/clinic/floatobject.c.h b/Objects/clinic/floatobject.c.h
index 8ff2a2beba..28b24d0a09 100644
--- a/Objects/clinic/floatobject.c.h
+++ b/Objects/clinic/floatobject.c.h
@@ -228,7 +228,17 @@ float___getformat__(PyTypeObject *type, PyObject *arg)
PyObject *return_value = NULL;
const char *typestr;
- if (!PyArg_Parse(arg, "s:__getformat__", &typestr)) {
+ if (!PyUnicode_Check(arg)) {
+ _PyArg_BadArgument("__getformat__", "str", arg);
+ goto exit;
+ }
+ Py_ssize_t typestr_length;
+ typestr = PyUnicode_AsUTF8AndSize(arg, &typestr_length);
+ if (typestr == NULL) {
+ goto exit;
+ }
+ if (strlen(typestr) != (size_t)typestr_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = float___getformat___impl(type, typestr);
@@ -297,12 +307,17 @@ float___format__(PyObject *self, PyObject *arg)
PyObject *return_value = NULL;
PyObject *format_spec;
- if (!PyArg_Parse(arg, "U:__format__", &format_spec)) {
+ if (!PyUnicode_Check(arg)) {
+ _PyArg_BadArgument("__format__", "str", arg);
+ goto exit;
+ }
+ if (PyUnicode_READY(arg) == -1) {
goto exit;
}
+ format_spec = arg;
return_value = float___format___impl(self, format_spec);
exit:
return return_value;
}
-/*[clinic end generated code: output=091dd499f5386a6c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e8f8be828462d58b input=a9049054013a1b77]*/