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 lizardlizard
Recipients Ryan May, ammar2, lizardlizard, mark.dickinson, ralf.gommers, rhettinger, seberg, serhiy.storchaka, tcaswell, terry.reedy, tim.peters, vstinner
Date 2020-08-26.00:13:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1598400786.85.0.4699672537.issue37980@roundup.psfhosted.org>
In-reply-to
Content
I found this bug searching after noticing weird behaviour in an error message saying sorted expects the reverse flag to be an integer, after it rejected None. This is very surprising. Why isn't it just casting the reverse parameter using bool() to discover it's truthyness?

In [1]: bool(None)
Out[1]: False

In [2]: sorted(['a','c','b'], reverse=None)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-45ce9ce13044> in <module>()
----> 1 sorted(['a','c','b'], reverse=None)

TypeError: an integer is required (got type NoneType)
History
Date User Action Args
2020-08-26 00:13:07lizardlizardsetrecipients: + lizardlizard, tim.peters, rhettinger, terry.reedy, mark.dickinson, vstinner, serhiy.storchaka, seberg, ralf.gommers, tcaswell, ammar2, Ryan May
2020-08-26 00:13:06lizardlizardsetmessageid: <1598400786.85.0.4699672537.issue37980@roundup.psfhosted.org>
2020-08-26 00:13:06lizardlizardlinkissue37980 messages
2020-08-26 00:13:06lizardlizardcreate