Skip to content

Commit c1e269a

Browse files
committed
replace PyString_AsString usages with PyUnicode_AsUTF8
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
1 parent 8977ff3 commit c1e269a

4 files changed

Lines changed: 3 additions & 6 deletions

File tree

src/keys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ static int PyXmlSec_KeyNameSet(PyObject* self, PyObject* value, void* closure) {
460460
return 0;
461461
}
462462

463-
name = PyString_AsString(value);
463+
name = PyUnicode_AsUTF8(value);
464464
if (name == NULL) return -1;
465465

466466
if (xmlSecKeySetName(key->handle, XSTR(name)) < 0) {

src/platform.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,11 @@ typedef int Py_ssize_t;
3838
#if PY_MAJOR_VERSION >= 3
3939
#define PY3K 1
4040

41-
#define PyString_AsString PyUnicode_AsUTF8
42-
4341
#define PyCreateDummyObject PyModule_New
4442

4543
#define PyString_FSConverter PyUnicode_FSConverter
4644
#else // PY3K
4745

48-
#define PyBytes_AsString PyString_AsString
4946
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
5047

5148
static inline PyObject* PyCreateDummyObject(const char* name) {

src/template.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ static PyObject* PyXmlSec_TemplateTransformAddC14NInclNamespaces(PyObject* self,
781781
}
782782

783783

784-
c_prefixes = PyString_AsString(prefixes);
784+
c_prefixes = PyUnicode_AsUTF8(prefixes);
785785
Py_BEGIN_ALLOW_THREADS;
786786
res = xmlSecTmplTransformAddC14NInclNamespaces(node->_c_node, XSTR(c_prefixes));
787787
Py_END_ALLOW_THREADS;

src/tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ static PyObject* PyXmlSec_TreeAddIds(PyObject* self, PyObject *args, PyObject *k
182182
tmp = PyObject_GetItem(ids, key);
183183
Py_DECREF(key);
184184
if (tmp == NULL) goto ON_FAIL;
185-
list[i] = XSTR(PyString_AsString(tmp));
185+
list[i] = XSTR(PyUnicode_AsUTF8(tmp));
186186
Py_DECREF(tmp);
187187
if (list[i] == NULL) goto ON_FAIL;
188188
}

0 commit comments

Comments
 (0)