diff options
author | Guido van Rossum <guido@python.org> | 2000-06-28 23:24:19 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-06-28 23:24:19 +0000 |
commit | b28fa08da1c9fd18ff8a8f7c69fea3692a8f496c (patch) | |
tree | 2f5d3a1c6edc63e4fa22980156ec0d334cedf86d /Python | |
parent | 2e8731db9db54d0104a56d69ec3b300d8e2e62d7 (diff) | |
download | cpython-b28fa08da1c9fd18ff8a8f7c69fea3692a8f496c.tar.gz |
Urmpf. Quality control on this patch lapsed a bit. :-(
The depth field was never decremented inside w_object(), and it was
never initialized in PyMarshal_WriteObjectToFile().
This caused imports from .pyc files to fil mysteriously when the .pyc
file was written by the broken code -- w_object() would bail out
early, but PyMarshal_WriteObjectToFile() doesn't check the error or
return an error code, and apparently the marshalling code doesn't call
PyErr_Check() either. (That's a separate patch if I feel like it.)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/marshal.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Python/marshal.c b/Python/marshal.c index a316d18e69..46b3fa09af 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -234,8 +234,9 @@ w_object(v, p) PyObject *utf8; utf8 = PyUnicode_AsUTF8String(v); if (utf8 == NULL) { - p->error = 1; - return; + p->depth--; + p->error = 1; + return; } w_byte(TYPE_UNICODE, p); n = PyString_GET_SIZE(utf8); @@ -303,6 +304,8 @@ w_object(v, p) w_byte(TYPE_UNKNOWN, p); p->error = 1; } + + p->depth--; } void @@ -325,6 +328,7 @@ PyMarshal_WriteObjectToFile(x, fp) WFILE wf; wf.fp = fp; wf.error = 0; + wf.depth = 0; w_object(x, &wf); } |