Mercurial > cpython-lru_cache-weakref
diff Include/bytesobject.h @ 42091:72fc7d029d3d
Add asserts to PyBytes_AS_STRING and PyBytes_GET_SIZE.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 14 Jun 2007 00:31:21 +0000 |
| parents | d1c3dd184e38 |
| children | e70cdce0e8b2 |
line wrap: on
line diff
--- a/Include/bytesobject.h Thu Jun 14 00:29:43 2007 +0000 +++ b/Include/bytesobject.h Thu Jun 14 00:31:21 2007 +0000 @@ -41,8 +41,8 @@ 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 }
