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 gvanrossum
Recipients gvanrossum, josh.r, serhiy.storchaka, steven.daprano, xtreak
Date 2019-01-11.16:07:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAP7+vJJBykV=qmrofzaAGD-t8riANayPabNH8USHTKMuE+_xpg@mail.gmail.com>
In-reply-to <1547191447.4.0.544785737787.issue35712@roundup.psfhosted.org>
Content
I agree.

On Thu, Jan 10, 2019 at 11:24 PM Serhiy Storchaka <report@bugs.python.org>
wrote:

>
> Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment:
>
> This is a common mistake. Even the default implementation of object.__ne__
> had a bug, fixed only 4 years ago in issue21408. There were several errors
> in stdlib. I am sure there is a lot of occurrences of this errors in a
> third party code.
>
> So I like this idea. This can help to fix hidden errors in existing code.
> But I share also Josh's concerns.
>
> There is related common mistake. In C code, the result of
> PyObject_IsTrue() often is treated as just a boolean, without checking for
> errors. Fortunately, in the current CPython code it is handled properly,
> but I am sure this error still is occurred in third-party extensions.
>
> When these two errors (using NotImplemented in the boolean context and
> ignoring the error in PyObject_IsTrue() in the C code) meet, this can lead
> to manifestation of more weird bugs than treating NotImplemented as true:
> from a crash in debug build to raising an exception in the following
> unrelated code.
>
> I suggest to start emitting a DeprecationWarning or a FutureWarning in
> NotImplemented.__bool__.
>
> ----------
> nosy: +gvanrossum, serhiy.storchaka
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue35712>
> _______________________________________
>
-- 
--Guido (mobile)
History
Date User Action Args
2019-01-11 16:07:44gvanrossumsetrecipients: + gvanrossum, steven.daprano, serhiy.storchaka, josh.r, xtreak
2019-01-11 16:07:42gvanrossumlinkissue35712 messages
2019-01-11 16:07:42gvanrossumcreate