summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--immutables/_map.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/immutables/_map.c b/immutables/_map.c
index 9f57582..652e171 100644
--- a/immutables/_map.c
+++ b/immutables/_map.c
@@ -810,15 +810,17 @@ map_node_bitmap_assoc(MapNode_Bitmap *self,
return (MapNode *)self;
}
- /* We're setting a new value for the key we had before.
- Make a new bitmap node with a replaced value, and return it. */
+ /* We're setting a new value for the key we had before. */
if (mutid != 0 && self->b_mutid == mutid) {
+ /* We've been mutating this node before: update inplace. */
Py_INCREF(val);
Py_SETREF(self->b_array[val_idx], val);
Py_INCREF(self);
return (MapNode *)self;
}
else {
+ /* Make a new bitmap node with a replaced value,
+ and return it. */
MapNode_Bitmap *ret = map_node_bitmap_clone(self, mutid);
if (ret == NULL) {
return NULL;