@@ -1723,7 +1723,7 @@ c_void_p_from_param(PyObject *type, PyObject *value)
17231723 if (stgd && CDataObject_Check (value ) && stgd -> proto && PyUnicode_Check (stgd -> proto )) {
17241724 PyCArgObject * parg ;
17251725
1726- switch (_PyUnicode_AsString (stgd -> proto )[0 ]) {
1726+ switch (PyUnicode_AsUTF8 (stgd -> proto )[0 ]) {
17271727 case 'z' : /* c_char_p */
17281728 case 'Z' : /* c_wchar_p */
17291729 parg = PyCArgObject_new ();
@@ -1835,7 +1835,7 @@ PyCSimpleType_paramfunc(CDataObject *self)
18351835
18361836 dict = PyObject_stgdict ((PyObject * )self );
18371837 assert (dict ); /* Cannot be NULL for CDataObject instances */
1838- fmt = _PyUnicode_AsString (dict -> proto );
1838+ fmt = PyUnicode_AsUTF8 (dict -> proto );
18391839 assert (fmt );
18401840
18411841 fd = _ctypes_get_fielddesc (fmt );
@@ -2059,7 +2059,7 @@ PyCSimpleType_from_param(PyObject *type, PyObject *value)
20592059 assert (dict );
20602060
20612061 /* I think we can rely on this being a one-character string */
2062- fmt = _PyUnicode_AsString (dict -> proto );
2062+ fmt = PyUnicode_AsUTF8 (dict -> proto );
20632063 assert (fmt );
20642064
20652065 fd = _ctypes_get_fielddesc (fmt );
@@ -3128,7 +3128,7 @@ _check_outarg_type(PyObject *arg, Py_ssize_t index)
31283128 /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */
31293129 && PyUnicode_Check (dict -> proto )
31303130/* We only allow c_void_p, c_char_p and c_wchar_p as a simple output parameter type */
3131- && (strchr ("PzZ" , _PyUnicode_AsString (dict -> proto )[0 ]))) {
3131+ && (strchr ("PzZ" , PyUnicode_AsUTF8 (dict -> proto )[0 ]))) {
31323132 return 1 ;
31333133 }
31343134
@@ -3218,7 +3218,7 @@ _get_name(PyObject *obj, const char **pname)
32183218 return * pname ? 1 : 0 ;
32193219 }
32203220 if (PyUnicode_Check (obj )) {
3221- * pname = _PyUnicode_AsString (obj );
3221+ * pname = PyUnicode_AsUTF8 (obj );
32223222 return * pname ? 1 : 0 ;
32233223 }
32243224 PyErr_SetString (PyExc_TypeError ,
@@ -5233,7 +5233,7 @@ cast_check_pointertype(PyObject *arg)
52335233 dict = PyType_stgdict (arg );
52345234 if (dict ) {
52355235 if (PyUnicode_Check (dict -> proto )
5236- && (strchr ("sPzUZXO" , _PyUnicode_AsString (dict -> proto )[0 ]))) {
5236+ && (strchr ("sPzUZXO" , PyUnicode_AsUTF8 (dict -> proto )[0 ]))) {
52375237 /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */
52385238 return 1 ;
52395239 }
0 commit comments