@@ -223,25 +223,20 @@ static PyObject *get_interfaces_info(PyObject *self __unused, PyObject *args) {
223223
224224 /* Parse input arguments if we got them */
225225 if ( inargs != NULL ) {
226- if ( PyBytes_Check (inargs ) ) { /* Input argument is just a string */
226+ if ( PyStr_Check (inargs ) ) { /* Input argument is just a string */
227227 fetch_devs_len = 1 ;
228228 fetch_devs = calloc (1 , sizeof (char * ));
229- fetch_devs [0 ] = PyBytes_AsString (inargs );
230- #if PY_MAJOR_VERSION >= 3
231- } else if ( PyUnicode_Check (inargs ) ) { /* Input argument is just a ustring */
232- fetch_devs_len = 1 ;
233- fetch_devs = calloc (1 , sizeof (char * ));
234- fetch_devs [0 ] = PyUnicode_AsUTF8 (inargs );
235- #endif
229+ fetch_devs [0 ] = PyStr_AsString (inargs );
230+
236231 } else if ( PyTuple_Check (inargs ) ) { /* Input argument is a tuple list with devices */
237232 int j = 0 ;
238233
239234 fetch_devs_len = PyTuple_Size (inargs );
240235 fetch_devs = calloc (fetch_devs_len + 1 , sizeof (char * ));
241236 for ( i = 0 ; i < fetch_devs_len ; i ++ ) {
242237 PyObject * elmt = PyTuple_GetItem (inargs , i );
243- if ( elmt && PyBytes_Check (elmt ) ) {
244- fetch_devs [j ++ ] = PyBytes_AsString (elmt );
238+ if ( elmt && PyStr_Check (elmt ) ) {
239+ fetch_devs [j ++ ] = PyStr_AsString (elmt );
245240 }
246241 }
247242 fetch_devs_len = j ;
@@ -252,8 +247,8 @@ static PyObject *get_interfaces_info(PyObject *self __unused, PyObject *args) {
252247 fetch_devs = calloc (fetch_devs_len + 1 , sizeof (char * ));
253248 for ( i = 0 ; i < fetch_devs_len ; i ++ ) {
254249 PyObject * elmt = PyList_GetItem (inargs , i );
255- if ( elmt && PyBytes_Check (elmt ) ) {
256- fetch_devs [j ++ ] = PyBytes_AsString (elmt );
250+ if ( elmt && PyStr_Check (elmt ) ) {
251+ fetch_devs [j ++ ] = PyStr_AsString (elmt );
257252 }
258253 }
259254 fetch_devs_len = j ;
0 commit comments