bpo-46852: Rename float.set_format() to float.setformat() (GH… · python/cpython@a549cd1 (original) (raw)
File tree
3 files changed
lines changed
- Misc/NEWS.d/next/Core and Builtins
3 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
1 | +Rename the private undocumented ``float.__set_format__()`` method to | |
2 | +``float.__setformat__()`` to fix a typo introduced in Python 3.7. The method | |
3 | +is only used by test_float. Patch by Victor Stinner. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1702,7 +1702,7 @@ float___getformat___impl(PyTypeObject *type, const char *typestr) | ||
1702 | 1702 | |
1703 | 1703 | /*[clinic input] |
1704 | 1704 | @classmethod |
1705 | -float.__set_format__ | |
1705 | +float.__setformat__ | |
1706 | 1706 | |
1707 | 1707 | typestr: str |
1708 | 1708 | Must be 'double' or 'float'. |
@@ -1721,9 +1721,9 @@ This affects how floats are converted to and from binary strings. | ||
1721 | 1721 | [clinic start generated code]*/ |
1722 | 1722 | |
1723 | 1723 | static PyObject * |
1724 | -float___set_format___impl(PyTypeObject *type, const char *typestr, | |
1725 | - const char *fmt) | |
1726 | -/*[clinic end generated code: output=504460f5dc85acbd input=5306fa2b81a997e4]*/ | |
1724 | +float___setformat___impl(PyTypeObject *type, const char *typestr, | |
1725 | +const char *fmt) | |
1726 | +/*[clinic end generated code: output=06864de1fb5f1f04 input=c0e9e04dd87f9988]*/ | |
1727 | 1727 | { |
1728 | 1728 | float_format_type f; |
1729 | 1729 | float_format_type detected; |
@@ -1825,7 +1825,7 @@ static PyMethodDef float_methods[] = { | ||
1825 | 1825 | FLOAT_IS_INTEGER_METHODDEF |
1826 | 1826 | FLOAT___GETNEWARGS___METHODDEF |
1827 | 1827 | FLOAT___GETFORMAT___METHODDEF |
1828 | -FLOAT___SET_FORMAT___METHODDEF | |
1828 | +FLOAT___SETFORMAT___METHODDEF | |
1829 | 1829 | FLOAT___FORMAT___METHODDEF |
1830 | 1830 | {NULL, NULL} /* sentinel */ |
1831 | 1831 | }; |