summaryrefslogtreecommitdiffstats
path: root/Modules/_ctypes
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-20 07:13:07 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-20 07:13:07 (GMT)
commit06515833fef7b8b5c7968edf72367d94ff7eb1e0 (patch)
tree58a7c06bba8141883a5e5c8621d2b0683ae9fe2e /Modules/_ctypes
parente20973926a2ec19c4b87e460dc6f0edb478ce352 (diff)
downloadcpython-06515833fef7b8b5c7968edf72367d94ff7eb1e0.zip
cpython-06515833fef7b8b5c7968edf72367d94ff7eb1e0.tar.gz
cpython-06515833fef7b8b5c7968edf72367d94ff7eb1e0.tar.bz2
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r--Modules/_ctypes/_ctypes.c12
-rw-r--r--Modules/_ctypes/stgdict.c2
2 files changed, 7 insertions, 7 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 65c950e..4807e4f 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -1723,7 +1723,7 @@ c_void_p_from_param(PyObject *type, PyObject *value)
if (stgd && CDataObject_Check(value) && stgd->proto && PyUnicode_Check(stgd->proto)) {
PyCArgObject *parg;
- switch (_PyUnicode_AsString(stgd->proto)[0]) {
+ switch (PyUnicode_AsUTF8(stgd->proto)[0]) {
case 'z': /* c_char_p */
case 'Z': /* c_wchar_p */
parg = PyCArgObject_new();
@@ -1835,7 +1835,7 @@ PyCSimpleType_paramfunc(CDataObject *self)
dict = PyObject_stgdict((PyObject *)self);
assert(dict); /* Cannot be NULL for CDataObject instances */
- fmt = _PyUnicode_AsString(dict->proto);
+ fmt = PyUnicode_AsUTF8(dict->proto);
assert(fmt);
fd = _ctypes_get_fielddesc(fmt);
@@ -2059,7 +2059,7 @@ PyCSimpleType_from_param(PyObject *type, PyObject *value)
assert(dict);
/* I think we can rely on this being a one-character string */
- fmt = _PyUnicode_AsString(dict->proto);
+ fmt = PyUnicode_AsUTF8(dict->proto);
assert(fmt);
fd = _ctypes_get_fielddesc(fmt);
@@ -3128,7 +3128,7 @@ _check_outarg_type(PyObject *arg, Py_ssize_t index)
/* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */
&& PyUnicode_Check(dict->proto)
/* We only allow c_void_p, c_char_p and c_wchar_p as a simple output parameter type */
- && (strchr("PzZ", _PyUnicode_AsString(dict->proto)[0]))) {
+ && (strchr("PzZ", PyUnicode_AsUTF8(dict->proto)[0]))) {
return 1;
}
@@ -3218,7 +3218,7 @@ _get_name(PyObject *obj, const char **pname)
return *pname ? 1 : 0;
}
if (PyUnicode_Check(obj)) {
- *pname = _PyUnicode_AsString(obj);
+ *pname = PyUnicode_AsUTF8(obj);
return *pname ? 1 : 0;
}
PyErr_SetString(PyExc_TypeError,
@@ -5233,7 +5233,7 @@ cast_check_pointertype(PyObject *arg)
dict = PyType_stgdict(arg);
if (dict) {
if (PyUnicode_Check(dict->proto)
- && (strchr("sPzUZXO", _PyUnicode_AsString(dict->proto)[0]))) {
+ && (strchr("sPzUZXO", PyUnicode_AsUTF8(dict->proto)[0]))) {
/* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */
return 1;
}
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c
index 6c0fda9..716d1e9 100644
--- a/Modules/_ctypes/stgdict.c
+++ b/Modules/_ctypes/stgdict.c
@@ -489,7 +489,7 @@ PyCStructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct
if (isStruct && !isPacked) {
char *fieldfmt = dict->format ? dict->format : "B";
- char *fieldname = _PyUnicode_AsString(name);
+ char *fieldname = PyUnicode_AsUTF8(name);
char *ptr;
Py_ssize_t len;
char *buf;