aboutsummaryrefslogtreecommitdiff
path: root/immutables
diff options
context:
space:
mode:
authorTIGirardi <55336837+TIGirardi@users.noreply.github.com>2020-04-22 19:40:46 -0300
committerGitHub <noreply@github.com>2020-04-22 15:40:46 -0700
commitad137a3b4900a3cec1b2a46888f70612dff18370 (patch)
tree1ac718ab5e92b7af27eb5cf55adb34be4c694986 /immutables
parent11863b29e3fbcd7d25335befce706e21a785f5e0 (diff)
downloadimmutables-ad137a3b4900a3cec1b2a46888f70612dff18370.tar.gz
immutables-ad137a3b4900a3cec1b2a46888f70612dff18370.zip
Fix the mutation API to maintain elements count correctly (#25, #24)
Diffstat (limited to 'immutables')
-rw-r--r--immutables/_map.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/immutables/_map.c b/immutables/_map.c
index 7e63562..89687d0 100644
--- a/immutables/_map.c
+++ b/immutables/_map.c
@@ -1806,6 +1806,7 @@ map_node_array_assoc(MapNode_Array *self,
if (mutid != 0 && self->a_mutid == mutid) {
new_node = self;
+ self->a_count++; /*must update count*/
Py_INCREF(self);
}
else {
@@ -1940,9 +1941,9 @@ map_node_array_without(MapNode_Array *self,
if (target == NULL) {
return W_ERROR;
}
- target->a_count = new_count;
}
+ target->a_count = new_count;
Py_CLEAR(target->a_array[idx]);
*new_node = (MapNode*)target; /* borrow */