[Python-3000-checkins] r56215 - python/branches/py3k-struni/Modules/_ctypes/_ctypes.c

guido.van.rossum python-3000-checkins at python.org
Mon Jul 9 16:28:12 CEST 2007


Author: guido.van.rossum
Date: Mon Jul  9 16:28:11 2007
New Revision: 56215

Modified:
   python/branches/py3k-struni/Modules/_ctypes/_ctypes.c
Log:
Forgot to submit this earlier; it's needed to make test_threading pass.


Modified: python/branches/py3k-struni/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/branches/py3k-struni/Modules/_ctypes/_ctypes.c	(original)
+++ python/branches/py3k-struni/Modules/_ctypes/_ctypes.c	Mon Jul  9 16:28:11 2007
@@ -797,14 +797,14 @@
 						  conversion_mode_errors);
 		if (!value)
 			return -1;
-	} else if (!PyString_Check(value)) {
+	} else if (!PyBytes_Check(value)) {
 		PyErr_Format(PyExc_TypeError,
-			     "string expected instead of %s instance",
+			     "str/bytes expected instead of %s instance",
 			     value->ob_type->tp_name);
 		return -1;
 	} else
 		Py_INCREF(value);
-	size = PyString_GET_SIZE(value);
+	size = PyBytes_GET_SIZE(value);
 	if (size > self->b_size) {
 		PyErr_SetString(PyExc_ValueError,
 				"string too long");
@@ -812,7 +812,7 @@
 		return -1;
 	}
 
-	ptr = PyString_AS_STRING(value);
+	ptr = PyBytes_AS_STRING(value);
 	memcpy(self->b_ptr, ptr, size);
 	if (size < self->b_size)
 		self->b_ptr[size] = '\0';


More information about the Python-3000-checkins mailing list