Mercurial > cpython-lru_cache-weakref
diff Python/structmember.c @ 2023:3d431a521132 legacy-trunk
- Added ability to get at strings embedded in the struct
- For the mac, added ability to get at pascal-style strings
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Wed, 14 Dec 1994 13:04:05 +0000 |
| parents | b724599401ff |
| children | d0d0a69b5ca3 |
line wrap: on
line diff
--- a/Python/structmember.c Wed Dec 14 12:58:37 1994 +0000 +++ b/Python/structmember.c Wed Dec 14 13:04:05 1994 +0000 @@ -108,6 +108,24 @@ else v = newstringobject(*(char**)addr); break; + case T_STRING_INPLACE: + v = newstringobject((char*)addr); + break; +#ifdef macintosh + case T_PSTRING: + if (*(char**)addr == NULL) { + INCREF(None); + v = None; + } + else + v = newsizedstringobject((*(char**)addr)+1, + **(unsigned char**)addr); + break; + case T_PSTRING_INPLACE: + v = newsizedstringobject(((char*)addr)+1, + *(unsigned char*)addr); + break; +#endif /* macintosh */ case T_CHAR: v = newsizedstringobject((char*)addr, 1); break; @@ -140,7 +158,11 @@ for (l = mlist; l->name != NULL; l++) { if (strcmp(l->name, name) == 0) { - if (l->readonly || l->type == T_STRING) { +#ifdef macintosh + if (l->readonly || l->type == T_STRING || l->type == T_PSTRING) { +#else + if (l->readonly || l->type == T_STRING ) { +#endif /* macintosh */ err_setstr(TypeError, "readonly attribute"); return -1; }
