Mercurial > cpython-lru_cache-weakref
diff Python/marshal.c @ 23851:d6ae544acd24 legacy-trunk
Fix SF bug # 561858 Assertion with very long lists
Write 4 bytes for co_stacksize, etc. to prevent writing out
bad .pyc files which can cause a crash when read back in.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Fri, 14 Jun 2002 01:07:39 +0000 |
| parents | aa8d59823add |
| children | 9ef82377669d |
line wrap: on
line diff
--- a/Python/marshal.c Fri Jun 14 00:50:42 2002 +0000 +++ b/Python/marshal.c Fri Jun 14 01:07:39 2002 +0000 @@ -241,10 +241,10 @@ else if (PyCode_Check(v)) { PyCodeObject *co = (PyCodeObject *)v; w_byte(TYPE_CODE, p); - w_short(co->co_argcount, p); - w_short(co->co_nlocals, p); - w_short(co->co_stacksize, p); - w_short(co->co_flags, p); + w_long(co->co_argcount, p); + w_long(co->co_nlocals, p); + w_long(co->co_stacksize, p); + w_long(co->co_flags, p); w_object(co->co_code, p); w_object(co->co_consts, p); w_object(co->co_names, p); @@ -253,7 +253,7 @@ w_object(co->co_cellvars, p); w_object(co->co_filename, p); w_object(co->co_name, p); - w_short(co->co_firstlineno, p); + w_long(co->co_firstlineno, p); w_object(co->co_lnotab, p); } else if (PyObject_CheckReadBuffer(v)) { @@ -588,10 +588,10 @@ return NULL; } else { - int argcount = r_short(p); - int nlocals = r_short(p); - int stacksize = r_short(p); - int flags = r_short(p); + int argcount = r_long(p); + int nlocals = r_long(p); + int stacksize = r_long(p); + int flags = r_long(p); PyObject *code = NULL; PyObject *consts = NULL; PyObject *names = NULL; @@ -612,7 +612,7 @@ if (cellvars) filename = r_object(p); if (filename) name = r_object(p); if (name) { - firstlineno = r_short(p); + firstlineno = r_long(p); lnotab = r_object(p); }
