summaryrefslogtreecommitdiffstats
path: root/Python/marshal.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2000-07-23 19:28:35 (GMT)
committerTim Peters <tim.peters@gmail.com>2000-07-23 19:28:35 (GMT)
commit8315ea579046727bb234dc4692ca28c8514eacbe (patch)
treed1b2e26eb953b19ee6c753e4842f604becf76fc1 /Python/marshal.c
parente21107145aed5b9bfeeb2f2d5f76944288c1dc07 (diff)
downloadcpython-8315ea579046727bb234dc4692ca28c8514eacbe.zip
cpython-8315ea579046727bb234dc4692ca28c8514eacbe.tar.gz
cpython-8315ea579046727bb234dc4692ca28c8514eacbe.tar.bz2
Included assert.h in Python.h -- it's absurd that this basic tool of
good C practice hasn't been available to everything all along. Added Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) macro to pyport.h; this just casts VALUE from type WIDE to type NARROW, but assert-fails if Py_DEBUG is defined and info is lost due to casting. Replaced a line in Fredrik's fix to marshal.c to use the new macro.
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index 74c5474..f644713 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -69,7 +69,7 @@ w_more(int c, WFILE *p)
p->ptr = PyString_AS_STRING((PyStringObject *)p->str) + size;
p->end =
PyString_AS_STRING((PyStringObject *)p->str) + newsize;
- *p->ptr++ = (char) c;
+ *p->ptr++ = Py_SAFE_DOWNCAST(c, int, char);
}
}