summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-06-14 00:31:21 (GMT)
committerGuido van Rossum <guido@python.org>2007-06-14 00:31:21 (GMT)
commit2d28f592451ea1504ef1064c7f345d09ca507137 (patch)
treec3b75e49c7622a8998b7accbbbb808b003c714c7
parent27ff74d8a98ce8a3ba2134568da730926862c7a4 (diff)
downloadcpython-2d28f592451ea1504ef1064c7f345d09ca507137.zip
cpython-2d28f592451ea1504ef1064c7f345d09ca507137.tar.gz
cpython-2d28f592451ea1504ef1064c7f345d09ca507137.tar.bz2
Add asserts to PyBytes_AS_STRING and PyBytes_GET_SIZE.
-rw-r--r--Include/bytesobject.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/Include/bytesobject.h b/Include/bytesobject.h
index bc385c1..9c1f4ba 100644
--- a/Include/bytesobject.h
+++ b/Include/bytesobject.h
@@ -41,8 +41,8 @@ PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
PyAPI_FUNC(int) PyBytes_Resize(PyObject *, Py_ssize_t);
/* Macros, trading safety for speed */
-#define PyBytes_AS_STRING(self) (((PyBytesObject *)(self))->ob_bytes)
-#define PyBytes_GET_SIZE(self) (((PyBytesObject *)(self))->ob_size)
+#define PyBytes_AS_STRING(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_bytes)
+#define PyBytes_GET_SIZE(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_size)
#ifdef __cplusplus
}