Skip to content

Commit 189c8e1

Browse files
committed
Fixed the merge so it worked and compiled and stuff
1 parent 13e64f0 commit 189c8e1

1 file changed

Lines changed: 7 additions & 18 deletions

File tree

py/objset.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,6 @@ void set_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj
4646
}
4747

4848

49-
static mp_obj_t set_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
50-
mp_obj_set_t *o = lhs_in;
51-
switch (op) {
52-
case RT_COMPARE_OP_IN:
53-
case RT_COMPARE_OP_NOT_IN:
54-
{
55-
mp_obj_t elem = mp_set_lookup(&o->set, rhs_in, false);
56-
return ((op == RT_COMPARE_OP_IN) ^ (elem == NULL))
57-
? mp_const_true : mp_const_false;
58-
}
59-
default:
60-
// op not supported
61-
return NULL;
62-
}
63-
}
64-
65-
6649
static mp_obj_t set_make_new(mp_obj_t type_in, int n_args, const mp_obj_t *args) {
6750
switch (n_args) {
6851
case 0:
@@ -423,6 +406,13 @@ static mp_obj_t set_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
423406
return set_issuperset(lhs, rhs);
424407
case RT_COMPARE_OP_NOT_EQUAL:
425408
return MP_BOOL(set_equal(lhs, rhs) == mp_const_false);
409+
case RT_COMPARE_OP_IN:
410+
case RT_COMPARE_OP_NOT_IN:
411+
{
412+
mp_obj_set_t *o = lhs;
413+
mp_obj_t elem = mp_set_lookup(&o->set, rhs, MP_MAP_LOOKUP);
414+
return MP_BOOL((op == RT_COMPARE_OP_IN) ^ (elem == NULL));
415+
}
426416
default:
427417
// op not supported
428418
return NULL;
@@ -458,7 +448,6 @@ const mp_obj_type_t set_type = {
458448
{ &mp_const_type },
459449
"set",
460450
.print = set_print,
461-
.binary_op = set_binary_op,
462451
.make_new = set_make_new,
463452
.binary_op = set_binary_op,
464453
.getiter = set_getiter,

0 commit comments

Comments
 (0)