Skip to content

Commit a549cd1

Browse files
authored
bpo-46852: Rename float.__set_format__() to float.__setformat__() (GH-31558) (GH-31581)
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 4560c7e commit a549cd1

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

17031703
/*[clinic input]
17041704
@classmethod
1705-
float.__set_format__
1705+
float.__setformat__
17061706
17071707
typestr: str
17081708
Must be 'double' or 'float'.
@@ -1721,9 +1721,9 @@ This affects how floats are converted to and from binary strings.
17211721
[clinic start generated code]*/
17221722

17231723
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]*/
17271727
{
17281728
float_format_type f;
17291729
float_format_type detected;
@@ -1825,7 +1825,7 @@ static PyMethodDef float_methods[] = {
18251825
FLOAT_IS_INTEGER_METHODDEF
18261826
FLOAT___GETNEWARGS___METHODDEF
18271827
FLOAT___GETFORMAT___METHODDEF
1828-
FLOAT___SET_FORMAT___METHODDEF
1828+
FLOAT___SETFORMAT___METHODDEF
18291829
FLOAT___FORMAT___METHODDEF
18301830
{NULL, NULL} /* sentinel */
18311831
};

0 commit comments

Comments
 (0)