[issue26776] Determining the failure of C API call is ambiguous

2016-04-16 Thread STINNER Victor
STINNER Victor added the comment: Ah yes. Some months (years?) ago, i started to add assertions to fail if some functions are called with an exception set. Checking if an exception is set at runtime adds a low overhead. Maybe it's better to fail with a fatal error (like an assertion error) in de

[issue26776] Determining the failure of C API call is ambiguous

2016-04-16 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: 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 t