On Mon, Feb 7, 2022 at 5:48 PM Guido van Rossum <gu...@python.org> wrote:
> So you're proposing to completely get rid of those three?

I don't propose to remove them, but only call them if Python is built
in debug mode. Or remove them from the release build, unless
./configure --with-assertions is used.


> And you're sure that each and every single call to any of those is better off 
> being an assert()?

For many years, many C extensions raised an exception *and* returned a
result: that's a bug. The strange part is that in some cases, the
exceptions is somehow ignored and the program continues running fine.

That's why I added _Py_CheckFunctionResult() and _Py_CheckSlotResult()
which helped to catch such bugs. But before that, these programs were
running fine :-)

So it's not fully clear to me there was really a bug or it's just that
Python became more pedantic :-)


About PyErr_BadInternalCall(): in 10 years, I saw a few SystemError
raised by this function, but usually when I hacked on Python. It's
really rare to hit such bug.


> (I still haven't gotten into the habit of building in debug mode by default, 
> in part because it *isn't* the default when you invoke ./configure or 
> PCbuild/build.bat.)

If you don't develop C extensions, the release mode is faster and enough ;-)

Ah. I don't know if CIs like GitHub Actions and Azure Pipelines
provide Python debug builds. If if it's not the case, it would be nice
to have the choice :-)

Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/KJNUCD3X37ZPHE2UYSJBO5ZHYFQTMPZA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to