diff options
author | Thomas Heller <theller@ctypes.org> | 2007-07-13 12:07:59 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2007-07-13 12:07:59 (GMT) |
commit | 27384da6e863b35fcee3e773c71c497406056458 (patch) | |
tree | f791de1153ed54907c3e4b4a87cd53ddb835c792 /Modules/_ctypes | |
parent | ace05054d3e146a6fa4435275b83bd8e99327fb1 (diff) | |
download | cpython-27384da6e863b35fcee3e773c71c497406056458.zip cpython-27384da6e863b35fcee3e773c71c497406056458.tar.gz cpython-27384da6e863b35fcee3e773c71c497406056458.tar.bz2 |
Do not accept str8 type in function calls any longer.
Accept bytes instead of str8 in the (unexposed in ctypes) BSTR type.
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r-- | Modules/_ctypes/callproc.c | 9 | ||||
-rw-r--r-- | Modules/_ctypes/cfield.c | 2 |
2 files changed, 1 insertions, 10 deletions
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index 35453d5..61be77b 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -507,15 +507,6 @@ static int ConvParam(PyObject *obj, Py_ssize_t index, struct argument *pa) return 0; } - /* XXX struni remove later */ - if (PyString_Check(obj)) { - pa->ffi_type = &ffi_type_pointer; - pa->value.p = PyString_AS_STRING(obj); - Py_INCREF(obj); - pa->keep = obj; - return 0; - } - if (PyBytes_Check(obj)) { pa->ffi_type = &ffi_type_pointer; pa->value.p = PyBytes_AsString(obj); diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c index da7e0fc..1b18879 100644 --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -1501,7 +1501,7 @@ BSTR_set(void *ptr, PyObject *value, Py_ssize_t size) /* convert value into a PyUnicodeObject or NULL */ if (Py_None == value) { value = NULL; - } else if (PyString_Check(value)) { + } else if (PyBytes_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); |