Skip to content

Commit 7d03c8b

Browse files
authored
bpo-46852: Rename float.__set_format__() to float.__setformat__() (pythonGH-31558)
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.
1 parent 1b2611e commit 7d03c8b

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
@@ -1762,7 +1762,7 @@ float___getformat___impl(PyTypeObject *type, const char *typestr)
17621762

17631763
/*[clinic input]
17641764
@classmethod
1765-
float.__set_format__
1765+
float.__setformat__
17661766
17671767
typestr: str
17681768
Must be 'double' or 'float'.
@@ -1781,9 +1781,9 @@ This affects how floats are converted to and from binary strings.
17811781
[clinic start generated code]*/
17821782

17831783
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]*/
17871787
{
17881788
float_format_type f;
17891789
float_format_type detected;
@@ -1885,7 +1885,7 @@ static PyMethodDef float_methods[] = {
18851885
FLOAT_IS_INTEGER_METHODDEF
18861886
FLOAT___GETNEWARGS___METHODDEF
18871887
FLOAT___GETFORMAT___METHODDEF
1888-
FLOAT___SET_FORMAT___METHODDEF
1888+
FLOAT___SETFORMAT___METHODDEF
18891889
FLOAT___FORMAT___METHODDEF
18901890
{NULL, NULL} /* sentinel */
18911891
};

0 commit comments

Comments
 (0)