Skip to content

Commit 39dd89f

Browse files
committed
py/runtime: When tracing unary/binary ops, output op (method) name.
E.g.: >>> 1+1 binary 26 __add__ 3 3 Output is similar to bytecode dump (numeric code, then op name).
1 parent c0877cb commit 39dd89f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

py/runtime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ void mp_delete_global(qstr qst) {
214214
}
215215

216216
mp_obj_t mp_unary_op(mp_unary_op_t op, mp_obj_t arg) {
217-
DEBUG_OP_printf("unary " UINT_FMT " %p\n", op, arg);
217+
DEBUG_OP_printf("unary " UINT_FMT " %q %p\n", op, mp_unary_op_method_name[op], arg);
218218

219219
if (op == MP_UNARY_OP_NOT) {
220220
// "not x" is the negative of whether "x" is true per Python semantics
@@ -275,7 +275,7 @@ mp_obj_t mp_unary_op(mp_unary_op_t op, mp_obj_t arg) {
275275
}
276276

277277
mp_obj_t mp_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) {
278-
DEBUG_OP_printf("binary " UINT_FMT " %p %p\n", op, lhs, rhs);
278+
DEBUG_OP_printf("binary " UINT_FMT " %q %p %p\n", op, mp_binary_op_method_name[op], lhs, rhs);
279279

280280
// TODO correctly distinguish inplace operators for mutable objects
281281
// lookup logic that CPython uses for +=:

0 commit comments

Comments
 (0)