Skip to content

Commit 2c7716f

Browse files
committed
py/objset: Ensure that use of frozenset.update raises an exception.
1 parent dd4135a commit 2c7716f

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

py/objset.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ STATIC void set_update_int(mp_obj_set_t *self, mp_obj_t other_in) {
435435
}
436436

437437
STATIC mp_obj_t set_update(size_t n_args, const mp_obj_t *args) {
438+
check_set(args[0]);
438439
for (mp_uint_t i = 1; i < n_args; i++) {
439440
set_update_int(MP_OBJ_TO_PTR(args[0]), args[i]);
440441
}

tests/basics/frozenset_add.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@
1010
print(s.add(5))
1111
except AttributeError:
1212
print("AttributeError")
13+
14+
try:
15+
print(s.update([5]))
16+
except AttributeError:
17+
print("AttributeError")

0 commit comments

Comments
 (0)