X Tutup
Skip to content

Commit fea60ff

Browse files
author
guido.van.rossum
committed
Add asserts to PyBytes_AS_STRING and PyBytes_GET_SIZE.
git-svn-id: http://svn.python.org/projects/python/branches/py3k-struni@55970 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent c75c1a6 commit fea60ff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Include/bytesobject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
4141
PyAPI_FUNC(int) PyBytes_Resize(PyObject *, Py_ssize_t);
4242

4343
/* Macros, trading safety for speed */
44-
#define PyBytes_AS_STRING(self) (((PyBytesObject *)(self))->ob_bytes)
45-
#define PyBytes_GET_SIZE(self) (((PyBytesObject *)(self))->ob_size)
44+
#define PyBytes_AS_STRING(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_bytes)
45+
#define PyBytes_GET_SIZE(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_size)
4646

4747
#ifdef __cplusplus
4848
}

0 commit comments

Comments
 (0)
X Tutup