Author: guido.van.rossum
Date: Thu Jun 14 02:31:21 2007
New Revision: 55970

Modified:
   python/branches/py3k-struni/Include/bytesobject.h
Log:
Add asserts to PyBytes_AS_STRING and PyBytes_GET_SIZE.


Modified: python/branches/py3k-struni/Include/bytesobject.h
==============================================================================
--- python/branches/py3k-struni/Include/bytesobject.h   (original)
+++ python/branches/py3k-struni/Include/bytesobject.h   Thu Jun 14 02:31:21 2007
@@ -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
 }
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to