bpo-46852: Rename float.set_format() to float.setformat() (GH… · python/cpython@0848da1 (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 |
---|---|---|
@@ -1748,7 +1748,7 @@ float___getformat___impl(PyTypeObject *type, const char *typestr) | ||
1748 | 1748 | |
1749 | 1749 | /*[clinic input] |
1750 | 1750 | @classmethod |
1751 | -float.__set_format__ | |
1751 | +float.__setformat__ | |
1752 | 1752 | |
1753 | 1753 | typestr: str |
1754 | 1754 | Must be 'double' or 'float'. |
@@ -1767,9 +1767,9 @@ This affects how floats are converted to and from binary strings. | ||
1767 | 1767 | [clinic start generated code]*/ |
1768 | 1768 | |
1769 | 1769 | static PyObject * |
1770 | -float___set_format___impl(PyTypeObject *type, const char *typestr, | |
1771 | - const char *fmt) | |
1772 | -/*[clinic end generated code: output=504460f5dc85acbd input=5306fa2b81a997e4]*/ | |
1770 | +float___setformat___impl(PyTypeObject *type, const char *typestr, | |
1771 | +const char *fmt) | |
1772 | +/*[clinic end generated code: output=06864de1fb5f1f04 input=c0e9e04dd87f9988]*/ | |
1773 | 1773 | { |
1774 | 1774 | float_format_type f; |
1775 | 1775 | float_format_type detected; |
@@ -1871,7 +1871,7 @@ static PyMethodDef float_methods[] = { | ||
1871 | 1871 | FLOAT_IS_INTEGER_METHODDEF |
1872 | 1872 | FLOAT___GETNEWARGS___METHODDEF |
1873 | 1873 | FLOAT___GETFORMAT___METHODDEF |
1874 | -FLOAT___SET_FORMAT___METHODDEF | |
1874 | +FLOAT___SETFORMAT___METHODDEF | |
1875 | 1875 | FLOAT___FORMAT___METHODDEF |
1876 | 1876 | {NULL, NULL} /* sentinel */ |
1877 | 1877 | }; |