Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 867bcbc

Browse files
committed
Forgot to submit this earlier; it's needed to make test_threading pass.
1 parent 65b6a80 commit 867bcbc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Modules/_ctypes/_ctypes.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -797,22 +797,22 @@ CharArray_set_value(CDataObject *self, PyObject *value)
797797
conversion_mode_errors);
798798
if (!value)
799799
return -1;
800-
} else if (!PyString_Check(value)) {
800+
} else if (!PyBytes_Check(value)) {
801801
PyErr_Format(PyExc_TypeError,
802-
"string expected instead of %s instance",
802+
"str/bytes expected instead of %s instance",
803803
value->ob_type->tp_name);
804804
return -1;
805805
} else
806806
Py_INCREF(value);
807-
size = PyString_GET_SIZE(value);
807+
size = PyBytes_GET_SIZE(value);
808808
if (size > self->b_size) {
809809
PyErr_SetString(PyExc_ValueError,
810810
"string too long");
811811
Py_DECREF(value);
812812
return -1;
813813
}
814814

815-
ptr = PyString_AS_STRING(value);
815+
ptr = PyBytes_AS_STRING(value);
816816
memcpy(self->b_ptr, ptr, size);
817817
if (size < self->b_size)
818818
self->b_ptr[size] = '\0';

0 commit comments

Comments
 (0)