This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients mark.dickinson, rhettinger, tim.peters, vstinner
Date 2022-02-25.00:54:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645750480.8.0.44647546371.issue46852@roundup.psfhosted.org>
In-reply-to
Content
Oh wait, I'm now confused by the method names. In Python 3.10, the correct names at:

* float.__getformat__() <= 4 underscores
* float.__set_format__() <= 5 underscores

It's even more confusing because the "set format" is only used in one place: test_float, and test_float uses... __setformat__() (4 underscores).

A typo a was introduced in Python 3.7 by:

commit b5c51d3dd95bbfde533655fb86ac0f96f771ba7b
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Sat Mar 11 09:21:05 2017 +0200

    bpo-20185: Convert float object implementation to Argument Clinic. (#543)
    
    Based on patch by Vajrasky Kok.

Since Python 3.7, the 4 "set format" tests are simply skipped!

$ ./python -m test -v test_float
(...)
test_getformat (test.test_float.FormatFunctionsTestCase) ... skipped 'requires __setformat__'
test_setformat (test.test_float.FormatFunctionsTestCase) ... skipped 'requires __setformat__'
(...)
test_double_specials_dont_unpack (test.test_float.UnknownFormatTestCase) ... skipped 'requires __setformat__'
test_float_specials_dont_unpack (test.test_float.UnknownFormatTestCase) ... skipped 'requires __setformat__'
(...)


Moreover, unittest.mock supports mocking __setformat__() (4 underscores).
History
Date User Action Args
2022-02-25 00:54:40vstinnersetrecipients: + vstinner, tim.peters, rhettinger, mark.dickinson
2022-02-25 00:54:40vstinnersetmessageid: <1645750480.8.0.44647546371.issue46852@roundup.psfhosted.org>
2022-02-25 00:54:40vstinnerlinkissue46852 messages
2022-02-25 00:54:40vstinnercreate