summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Include/mappingobject.h1
-rw-r--r--Objects/dictobject.c11
-rw-r--r--Objects/mappingobject.c11
3 files changed, 23 insertions, 0 deletions
diff --git a/Include/mappingobject.h b/Include/mappingobject.h
index f6d36e0..7d006dd 100644
--- a/Include/mappingobject.h
+++ b/Include/mappingobject.h
@@ -44,6 +44,7 @@ extern int mappinggetnext
extern object *getmappingkeys PROTO((object *mp));
extern object *getmappingvalues PROTO((object *mp));
extern object *getmappingitems PROTO((object *mp));
+extern int getmappingsize PROTO((object *mp));
#ifdef __cplusplus
}
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 2a51d51..b89b7b2 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -566,6 +566,17 @@ mapping_items(mp, args)
return v;
}
+int
+getmappingsize(mp)
+ object *mp;
+{
+ if (mp == NULL || !is_mappingobject(mp)) {
+ err_badcall();
+ return NULL;
+ }
+ return ((mappingobject *)mp)->ma_used;
+}
+
object *
getmappingkeys(mp)
object *mp;
diff --git a/Objects/mappingobject.c b/Objects/mappingobject.c
index 2a51d51..b89b7b2 100644
--- a/Objects/mappingobject.c
+++ b/Objects/mappingobject.c
@@ -566,6 +566,17 @@ mapping_items(mp, args)
return v;
}
+int
+getmappingsize(mp)
+ object *mp;
+{
+ if (mp == NULL || !is_mappingobject(mp)) {
+ err_badcall();
+ return NULL;
+ }
+ return ((mappingobject *)mp)->ma_used;
+}
+
object *
getmappingkeys(mp)
object *mp;