diff options
author | Victor Stinner <vstinner@python.org> | 2022-02-25 23:53:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-25 23:53:27 (GMT) |
commit | 5ab745fc51e159ead28b523414e52f0bcc1ef353 (patch) | |
tree | 02cb9106f63ae34f86803f92b604587abd359314 /Objects/clinic | |
parent | 4060111f9dc44682f9d7bdafb4e7dacb96706ad3 (diff) | |
download | cpython-5ab745fc51e159ead28b523414e52f0bcc1ef353.zip cpython-5ab745fc51e159ead28b523414e52f0bcc1ef353.tar.gz cpython-5ab745fc51e159ead28b523414e52f0bcc1ef353.tar.bz2 |
bpo-46852: Remove the float.__set_format__() method (GH-31585)
Remove the undocumented private float.__set_format__() method,
previously known as float.__set_format__() in Python 3.7. Its
docstring said: "You probably don't want to use this function. It
exists mainly to be used in Python's test suite."
Diffstat (limited to 'Objects/clinic')
-rw-r--r-- | Objects/clinic/floatobject.c.h | 69 |
1 files changed, 1 insertions, 68 deletions
diff --git a/Objects/clinic/floatobject.c.h b/Objects/clinic/floatobject.c.h index 2c638a2..f53018c 100644 --- a/Objects/clinic/floatobject.c.h +++ b/Objects/clinic/floatobject.c.h @@ -290,73 +290,6 @@ exit: return return_value; } -PyDoc_STRVAR(float___setformat____doc__, -"__setformat__($type, typestr, fmt, /)\n" -"--\n" -"\n" -"You probably don\'t want to use this function.\n" -"\n" -" typestr\n" -" Must be \'double\' or \'float\'.\n" -" fmt\n" -" Must be one of \'unknown\', \'IEEE, big-endian\' or \'IEEE, little-endian\',\n" -" and in addition can only be one of the latter two if it appears to\n" -" match the underlying C reality.\n" -"\n" -"It exists mainly to be used in Python\'s test suite.\n" -"\n" -"Override the automatic determination of C-level floating point type.\n" -"This affects how floats are converted to and from binary strings."); - -#define FLOAT___SETFORMAT___METHODDEF \ - {"__setformat__", (PyCFunction)(void(*)(void))float___setformat__, METH_FASTCALL|METH_CLASS, float___setformat____doc__}, - -static PyObject * -float___setformat___impl(PyTypeObject *type, const char *typestr, - const char *fmt); - -static PyObject * -float___setformat__(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - const char *typestr; - const char *fmt; - - if (!_PyArg_CheckPositional("__setformat__", nargs, 2, 2)) { - goto exit; - } - if (!PyUnicode_Check(args[0])) { - _PyArg_BadArgument("__setformat__", "argument 1", "str", args[0]); - goto exit; - } - Py_ssize_t typestr_length; - typestr = PyUnicode_AsUTF8AndSize(args[0], &typestr_length); - if (typestr == NULL) { - goto exit; - } - if (strlen(typestr) != (size_t)typestr_length) { - PyErr_SetString(PyExc_ValueError, "embedded null character"); - goto exit; - } - if (!PyUnicode_Check(args[1])) { - _PyArg_BadArgument("__setformat__", "argument 2", "str", args[1]); - goto exit; - } - Py_ssize_t fmt_length; - fmt = PyUnicode_AsUTF8AndSize(args[1], &fmt_length); - if (fmt == NULL) { - goto exit; - } - if (strlen(fmt) != (size_t)fmt_length) { - PyErr_SetString(PyExc_ValueError, "embedded null character"); - goto exit; - } - return_value = float___setformat___impl(type, typestr, fmt); - -exit: - return return_value; -} - PyDoc_STRVAR(float___format____doc__, "__format__($self, format_spec, /)\n" "--\n" @@ -388,4 +321,4 @@ float___format__(PyObject *self, PyObject *arg) exit: return return_value; } -/*[clinic end generated code: output=3fb0c0624cc87dff input=a9049054013a1b77]*/ +/*[clinic end generated code: output=604cb27bf751ea16 input=a9049054013a1b77]*/ |