bpo-46852: Rename float.set_format() to float.setformat() (GH… · python/cpython@7d03c8b (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 |
---|---|---|
@@ -1762,7 +1762,7 @@ float___getformat___impl(PyTypeObject *type, const char *typestr) | ||
1762 | 1762 | |
1763 | 1763 | /*[clinic input] |
1764 | 1764 | @classmethod |
1765 | -float.__set_format__ | |
1765 | +float.__setformat__ | |
1766 | 1766 | |
1767 | 1767 | typestr: str |
1768 | 1768 | Must be 'double' or 'float'. |
@@ -1781,9 +1781,9 @@ This affects how floats are converted to and from binary strings. | ||
1781 | 1781 | [clinic start generated code]*/ |
1782 | 1782 | |
1783 | 1783 | static PyObject * |
1784 | -float___set_format___impl(PyTypeObject *type, const char *typestr, | |
1785 | - const char *fmt) | |
1786 | -/*[clinic end generated code: output=504460f5dc85acbd input=5306fa2b81a997e4]*/ | |
1784 | +float___setformat___impl(PyTypeObject *type, const char *typestr, | |
1785 | +const char *fmt) | |
1786 | +/*[clinic end generated code: output=06864de1fb5f1f04 input=c0e9e04dd87f9988]*/ | |
1787 | 1787 | { |
1788 | 1788 | float_format_type f; |
1789 | 1789 | float_format_type detected; |
@@ -1885,7 +1885,7 @@ static PyMethodDef float_methods[] = { | ||
1885 | 1885 | FLOAT_IS_INTEGER_METHODDEF |
1886 | 1886 | FLOAT___GETNEWARGS___METHODDEF |
1887 | 1887 | FLOAT___GETFORMAT___METHODDEF |
1888 | -FLOAT___SET_FORMAT___METHODDEF | |
1888 | +FLOAT___SETFORMAT___METHODDEF | |
1889 | 1889 | FLOAT___FORMAT___METHODDEF |
1890 | 1890 | {NULL, NULL} /* sentinel */ |
1891 | 1891 | }; |