summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-03-21 16:42:36 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-03-21 16:42:36 (GMT)
commitbc4ded9bc05f4c6924b5a7efc4dd9705999b99fa (patch)
tree972b12ea94489b3f50f0e1087647508d658ee9f8 /Mac
parent47345a794fbe9b390358037169bbdf55feac1c70 (diff)
downloadcpython-bc4ded9bc05f4c6924b5a7efc4dd9705999b99fa.zip
cpython-bc4ded9bc05f4c6924b5a7efc4dd9705999b99fa.tar.gz
cpython-bc4ded9bc05f4c6924b5a7efc4dd9705999b99fa.tar.bz2
Give a better error message when a string of the wrong size is
passed to RawBitMap.
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/qd/_Qdmodule.c10
-rw-r--r--Mac/Modules/qd/qdsupport.py4
2 files changed, 9 insertions, 5 deletions
diff --git a/Mac/Modules/qd/_Qdmodule.c b/Mac/Modules/qd/_Qdmodule.c
index 8187baa..f2994db 100644
--- a/Mac/Modules/qd/_Qdmodule.c
+++ b/Mac/Modules/qd/_Qdmodule.c
@@ -14,9 +14,9 @@
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
- PyErr_SetString(PyExc_NotImplementedError, \
- "Not available in this shared library/OS version"); \
- return NULL; \
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
}} while(0)
@@ -6258,7 +6258,9 @@ static PyObject *Qd_RawBitMap(PyObject *_self, PyObject *_args)
if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) )
return NULL;
if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) {
- PyErr_BadArgument();
+ PyErr_Format(PyExc_TypeError,
+ "Argument size was %d, should be %d (sizeof BitMap) or %d (sizeof PixMap)",
+ PyString_Size(source), sizeof(BitMap), sizeof(PixMap));
return NULL;
}
ptr = (BitMapPtr)PyString_AsString(source);
diff --git a/Mac/Modules/qd/qdsupport.py b/Mac/Modules/qd/qdsupport.py
index 1e96980..18e628f 100644
--- a/Mac/Modules/qd/qdsupport.py
+++ b/Mac/Modules/qd/qdsupport.py
@@ -420,7 +420,9 @@ PyObject *source;
if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) )
return NULL;
if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) {
- PyErr_BadArgument();
+ PyErr_Format(PyExc_TypeError,
+ "Argument size was %d, should be %d (sizeof BitMap) or %d (sizeof PixMap)",
+ PyString_Size(source), sizeof(BitMap), sizeof(PixMap));
return NULL;
}
ptr = (BitMapPtr)PyString_AsString(source);