From 30cf503e978f7ccfedcaf14b46ab9fb3be065370 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 2 Feb 2017 23:33:49 +1100 Subject: [PATCH] py/objset: Make inplace binary operators actually modify the set. --- py/objset.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/py/objset.c b/py/objset.c index fc124fcd8c..246f505d98 100644 --- a/py/objset.c +++ b/py/objset.c @@ -489,13 +489,16 @@ STATIC mp_obj_t set_binary_op(mp_uint_t op, mp_obj_t lhs, mp_obj_t rhs) { case MP_BINARY_OP_SUBTRACT: return set_diff(2, args); case MP_BINARY_OP_INPLACE_OR: - return set_union(lhs, rhs); + set_update(2, args); + return lhs; case MP_BINARY_OP_INPLACE_XOR: - return set_symmetric_difference(lhs, rhs); + set_symmetric_difference_update(lhs, rhs); + return lhs; case MP_BINARY_OP_INPLACE_AND: - return set_intersect(lhs, rhs); + set_intersect_int(lhs, rhs, true); + return lhs; case MP_BINARY_OP_INPLACE_SUBTRACT: - return set_diff(2, args); + return set_diff_int(2, args, true); case MP_BINARY_OP_LESS: return set_issubset_proper(lhs, rhs); case MP_BINARY_OP_MORE: