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 2018-12-11.10:54:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1544525657.6.0.788709270274.issue35459@psf.upfronthosting.co.za>
In-reply-to
Content
There is an issue with using PyDict_GetItem(). Since it silences all exceptions, it can return incorrect result when an exception like MemoryError or KeyboardInterrupt was raised in the user __hash__() and __eq__(). In addition PyDict_GetItemString() and _PyDict_GetItemId() swallow a MemoryError raised when fail to allocate a temporary string object.

In addition, PyDict_GetItemWithError() is a tiny bit faster than PyDict_GetItem(), because it avoids checking the exception state in successful case.

The proposed PR replaces most calls of PyDict_GetItem(), PyDict_GetItemString() and _PyDict_GetItemId() with calls of PyDict_GetItemWithError(), _PyDict_GetItemStringWithError() and _PyDict_GetItemIdWithError().
History
Date User Action Args
2018-12-11 10:54:17serhiy.storchakasetrecipients: + serhiy.storchaka, vstinner
2018-12-11 10:54:17serhiy.storchakasetmessageid: <1544525657.6.0.788709270274.issue35459@psf.upfronthosting.co.za>
2018-12-11 10:54:17serhiy.storchakalinkissue35459 messages
2018-12-11 10:54:17serhiy.storchakacreate