Add asserts to PyBytes_AS_STRING and PyBytes_GET_SIZE.

This commit is contained in:
Guido van Rossum 2007-06-14 00:31:21 +00:00
parent 27ff74d8a9
commit 2d28f59245
1 changed files with 2 additions and 2 deletions

View File

@ -41,8 +41,8 @@ PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
PyAPI_FUNC(int) PyBytes_Resize(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyBytes_Resize(PyObject *, Py_ssize_t);
/* Macros, trading safety for speed */ /* Macros, trading safety for speed */
#define PyBytes_AS_STRING(self) (((PyBytesObject *)(self))->ob_bytes) #define PyBytes_AS_STRING(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_bytes)
#define PyBytes_GET_SIZE(self) (((PyBytesObject *)(self))->ob_size) #define PyBytes_GET_SIZE(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_size)
#ifdef __cplusplus #ifdef __cplusplus
} }