Skip to content

Commit cfe61ea

Browse files
committed
replace PyString_FSConverter usages with PyUnicode_FSConverter
Signed-off-by: oleg.hoefling <[email protected]>
1 parent d29be04 commit cfe61ea

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

src/keys.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ static PyObject* PyXmlSec_KeyFromBinaryFile(PyObject* self, PyObject* args, PyOb
249249

250250
PYXMLSEC_DEBUG("load symmetric key - start");
251251
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O&:from_binary_file", kwlist,
252-
PyXmlSec_KeyDataType, &keydata, PyString_FSConverter, &filepath))
252+
PyXmlSec_KeyDataType, &keydata, PyUnicode_FSConverter, &filepath))
253253
{
254254
goto ON_FAIL;
255255
}
@@ -698,7 +698,7 @@ static PyObject* PyXmlSec_KeysManagerLoadCert(PyObject* self, PyObject* args, Py
698698

699699
PYXMLSEC_DEBUGF("%p: load cert - start", self);
700700
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&II:load_cert", kwlist,
701-
PyString_FSConverter, &filepath, &format, &type)) {
701+
PyUnicode_FSConverter, &filepath, &format, &type)) {
702702
goto ON_FAIL;
703703
}
704704

src/platform.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,10 @@ typedef int Py_ssize_t;
3737

3838
#if PY_MAJOR_VERSION >= 3
3939
#define PY3K 1
40-
41-
#define PyString_FSConverter PyUnicode_FSConverter
4240
#else // PY3K
4341

4442
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
4543

46-
static inline int PyString_FSConverter(PyObject* o, PyObject** p) {
47-
if (o == NULL) {
48-
return 0;
49-
}
50-
51-
Py_INCREF(o);
52-
*p = o;
53-
return 1;
54-
}
55-
5644
#endif // PYTHON3
5745

5846
static inline char* PyBytes_AsStringAndSize2(PyObject *obj, Py_ssize_t* length) {

src/utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PyObject* PyXmlSec_GetFilePathOrContent(PyObject* file, int* is_content) {
2525
return data;
2626
}
2727
*is_content = 0;
28-
if (!PyString_FSConverter(file, &tmp)) {
28+
if (!PyUnicode_FSConverter(file, &tmp)) {
2929
return NULL;
3030
}
3131
return tmp;

0 commit comments

Comments
 (0)