Skip to content

Commit a7eb557

Browse files
committed
bpo-42979: Use _Py_CheckSlotResult() to check slots result
When Python is built in debug mode (with C assertions), calling a type slot like sq_length (__len__() in Python) now fails with a fatal error if the slot succeeded with an exception set, or failed with no exception set. The error message contains the slot, the type name, and the current exception (if an exception is set). * Check the result of all slots using _Py_CheckSlotResult(). * No longer pass op_name to ternary_op() in release mode. * Replace operator with dunder Python method name in error messages. For example, replace "*" with "__mul__". * Fix compiler_exit_scope() when an exception is set. * Fix bytearray.extend() when an exception is set: don't call bytearray_setslice() with an exception set.
1 parent 23a567c commit a7eb557

File tree

4 files changed

+304
-198
lines changed

4 files changed

+304
-198
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
When Python is built in debug mode (with C assertions), calling a type slot
2+
like ``sq_length`` (``__len__()`` in Python) now fails with a fatal error if
3+
the slot succeeded with an exception set, or failed with no exception set. The
4+
error message contains the slot, the type name, and the current exception (if
5+
an exception is set). Patch by Victor Stinner.

0 commit comments

Comments
 (0)