diff options
author | Guido van Rossum <guido@python.org> | 1993-11-10 09:23:53 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-11-10 09:23:53 (GMT) |
commit | a3d78fb268da5cf7cd4d990cf118bfc01650a8d9 (patch) | |
tree | 8b72efe5cef9a755ab55dd919f7e0591235b0345 /Modules/arraymodule.c | |
parent | b2e358d433e0ddbfc870d1a6ce12e7917388c2fe (diff) | |
download | cpython-a3d78fb268da5cf7cd4d990cf118bfc01650a8d9.zip cpython-a3d78fb268da5cf7cd4d990cf118bfc01650a8d9.tar.gz cpython-a3d78fb268da5cf7cd4d990cf118bfc01650a8d9.tar.bz2 |
* posixmodule.c: added set{uid,gid}.
* {tuple,list,mapping,array}object.c: call printobject with 0 for flags
* compile.c (parsestr): use quote instead of '\'' at one crucial point
* arraymodule.c (array_getattr): Added __members__ attribute
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r-- | Modules/arraymodule.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 248e431..5b62fee 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -993,6 +993,18 @@ array_getattr(a, name) if (strcmp(name, "itemsize") == 0) { return newintobject((long)a->ob_descr->itemsize); } + if (strcmp(name, "__members__") == 0) { + object *list = newlistobject(2); + if (list) { + setlistitem(list, 0, newstringobject("typecode")); + setlistitem(list, 1, newstringobject("itemsize")); + if (err_occurred()) { + DECREF(list); + list = NULL; + } + } + return list; + } return findmethod(array_methods, (object *)a, name); } @@ -1013,7 +1025,7 @@ array_print(a, fp, flags) if (a->ob_descr->typecode == 'c') { fprintf(fp, "array('c', "); v = array_tostring(a, (object *)NULL); - ok = printobject(v, fp, flags); + ok = printobject(v, fp, 0); XDECREF(v); fprintf(fp, ")"); return ok; @@ -1023,7 +1035,7 @@ array_print(a, fp, flags) if (i > 0) fprintf(fp, ", "); v = (a->ob_descr->getitem)(a, i); - ok = printobject(v, fp, flags); + ok = printobject(v, fp, 0); XDECREF(v); } fprintf(fp, "])"); |