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

Skip to content

Commit e16d250

Browse files
author
Thomas Heller
committed
PyUnicode_AsEncodedString() returns a bytes object.
1 parent 13eb6ca commit e16d250

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Modules/_ctypes/cfield.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,8 @@ z_set(void *ptr, PyObject *value, Py_ssize_t size)
13431343
conversion_mode_errors);
13441344
if (str == NULL)
13451345
return NULL;
1346-
*(char **)ptr = PyString_AS_STRING(str);
1346+
assert(PyBytes_Check(str));
1347+
*(char **)ptr = PyBytes_AS_STRING(str);
13471348
return str;
13481349
} else if (PyInt_Check(value) || PyLong_Check(value)) {
13491350
#if SIZEOF_VOID_P == SIZEOF_LONG_LONG

0 commit comments

Comments
 (0)