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 serhiy.storchaka
Recipients serhiy.storchaka, vstinner
Date 2020-10-26.07:15:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603696519.5.0.953690832641.issue42006@roundup.psfhosted.org>
In-reply-to
Content
My plan is to deprecate PyDict_GetItem() and functions with same design flaw and finally remove them (in 4.0?).

We cannot start to ignore exceptions in PyDict_GetItem(). It would not fix the original flaw when the user code does not check an exception after using PyDict_GetItem(), and only make it worse. It can cause crashes in the code which asserts that the exception is not set (for example when function returns value and sets exception). And in worst case it will lead to incorrect results when PyErr_Occurred() is used after calling other C API function.

Emitting a DeprecationWarning only when PyDict_GetItem() is called with an exception raised does not make much sense, because the problem with PyDict_GetItem() is not only in this case. Also, there is a trick in using warnings here, you should use PyErr_WriteUnraisable(), so warnings always will be printed and cannot be turned into exceptions.
History
Date User Action Args
2020-10-26 07:15:19serhiy.storchakasetrecipients: + serhiy.storchaka, vstinner
2020-10-26 07:15:19serhiy.storchakasetmessageid: <1603696519.5.0.953690832641.issue42006@roundup.psfhosted.org>
2020-10-26 07:15:19serhiy.storchakalinkissue42006 messages
2020-10-26 07:15:19serhiy.storchakacreate