Mercurial > cpython-lru_cache-weakref
diff Modules/arraymodule.c @ 1405:90c5e2bb4da5 legacy-trunk
* 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
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 10 Nov 1993 09:23:53 +0000 |
| parents | 1ce2c0f565ef |
| children | c914b10bf2ed |
line wrap: on
line diff
--- a/Modules/arraymodule.c Mon Nov 08 15:10:43 1993 +0000 +++ b/Modules/arraymodule.c Wed Nov 10 09:23:53 1993 +0000 @@ -993,6 +993,18 @@ 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 @@ 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 @@ 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, "])");
