Skip to content

Commit 0848da1

Browse files
authored
bpo-46852: Rename float.__set_format__() to float.__setformat__() (GH-31558) (GH-31578)
Rename the private undocumented float.__set_format__() method to float.__setformat__() to fix a typo introduced in Python 3.7. The method is only used by test_float. The change enables again test_float tests on the float format which were previously skipped because of the typo. The typo was introduced in Python 3.7 by bpo-20185 in commit b5c51d3. (cherry picked from commit 7d03c8b)
1 parent 2b7e04d commit 0848da1

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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.

Objects/clinic/floatobject.c.h

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Objects/floatobject.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ float___getformat___impl(PyTypeObject *type, const char *typestr)
17481748

17491749
/*[clinic input]
17501750
@classmethod
1751-
float.__set_format__
1751+
float.__setformat__
17521752
17531753
typestr: str
17541754
Must be 'double' or 'float'.
@@ -1767,9 +1767,9 @@ This affects how floats are converted to and from binary strings.
17671767
[clinic start generated code]*/
17681768

17691769
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]*/
17731773
{
17741774
float_format_type f;
17751775
float_format_type detected;
@@ -1871,7 +1871,7 @@ static PyMethodDef float_methods[] = {
18711871
FLOAT_IS_INTEGER_METHODDEF
18721872
FLOAT___GETNEWARGS___METHODDEF
18731873
FLOAT___GETFORMAT___METHODDEF
1874-
FLOAT___SET_FORMAT___METHODDEF
1874+
FLOAT___SETFORMAT___METHODDEF
18751875
FLOAT___FORMAT___METHODDEF
18761876
{NULL, NULL} /* sentinel */
18771877
};

0 commit comments

Comments
 (0)