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 2016-04-16.08:02:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1460793758.51.0.304392536592.issue26776@psf.upfronthosting.co.za>
In-reply-to
Content
C API functions returns a special value unambiguously signaling about a raised exception (NULL or -1). But in some cases this is ambiguous, because the special value is a legitimate value (e.g. -1 for PyLong_AsLong() or NULL for PyDict_GetItem()). Needed to use PyErr_Occurred() to distinguish between successful and failed call.

The problem is that if PyLong_AsLong() is called when the exception is set, successful call returned -1 is interpreted as failed. Since it is happen in very rare case, this bug is usually unnoticed.

Attached experimental patch makes some functions like PyLong_AsLong() always failing if called with an exception set. Some tests are failed with it applied: test_compile test_datetime test_io test_os test_symtable test_syntax test_xml_etree_c.
History
Date User Action Args
2016-04-16 08:02:38serhiy.storchakasetrecipients: + serhiy.storchaka, vstinner
2016-04-16 08:02:38serhiy.storchakasetmessageid: <1460793758.51.0.304392536592.issue26776@psf.upfronthosting.co.za>
2016-04-16 08:02:38serhiy.storchakalinkissue26776 messages
2016-04-16 08:02:38serhiy.storchakacreate