@@ -1380,6 +1380,11 @@ makebdaddr(bdaddr_t *bdaddr)
1380
1380
}
1381
1381
#endif
1382
1382
1383
+ PyObject *
1384
+ unicode_fsdecode (void * arg )
1385
+ {
1386
+ return PyUnicode_DecodeFSDefault ((const char * )arg );
1387
+ }
1383
1388
1384
1389
/* Create an object representing the given socket address,
1385
1390
suitable for passing it back to bind(), connect() etc.
@@ -1616,26 +1621,25 @@ makesockaddr(SOCKET_T sockfd, struct sockaddr *addr, size_t addrlen, int proto)
1616
1621
#ifdef CAN_ISOTP
1617
1622
case CAN_ISOTP :
1618
1623
{
1619
- return Py_BuildValue ("O&kk" , PyUnicode_DecodeFSDefault ,
1620
- ifname ,
1621
- a -> can_addr .tp .rx_id ,
1622
- a -> can_addr .tp .tx_id );
1624
+ return Py_BuildValue ("O&kk" , unicode_fsdecode ,
1625
+ ifname ,
1626
+ a -> can_addr .tp .rx_id ,
1627
+ a -> can_addr .tp .tx_id );
1623
1628
}
1624
1629
#endif /* CAN_ISOTP */
1625
1630
#ifdef CAN_J1939
1626
1631
case CAN_J1939 :
1627
1632
{
1628
- return Py_BuildValue ("O&KIB" , PyUnicode_DecodeFSDefault ,
1629
- ifname ,
1630
- (unsigned long long )a -> can_addr .j1939 .name ,
1631
- (unsigned int )a -> can_addr .j1939 .pgn ,
1632
- a -> can_addr .j1939 .addr );
1633
+ return Py_BuildValue ("O&KIB" , unicode_fsdecode ,
1634
+ ifname ,
1635
+ (unsigned long long )a -> can_addr .j1939 .name ,
1636
+ (unsigned int )a -> can_addr .j1939 .pgn ,
1637
+ a -> can_addr .j1939 .addr );
1633
1638
}
1634
1639
#endif /* CAN_J1939 */
1635
1640
default :
1636
1641
{
1637
- return Py_BuildValue ("(O&)" , PyUnicode_DecodeFSDefault ,
1638
- ifname );
1642
+ return Py_BuildValue ("(O&)" , unicode_fsdecode , ifname );
1639
1643
}
1640
1644
}
1641
1645
}
@@ -7161,7 +7165,7 @@ socket_if_nameindex(PyObject *self, PyObject *arg)
7161
7165
}
7162
7166
#endif
7163
7167
PyObject * ni_tuple = Py_BuildValue ("IO&" ,
7164
- ni [i ].if_index , PyUnicode_DecodeFSDefault , ni [i ].if_name );
7168
+ ni [i ].if_index , unicode_fsdecode , ni [i ].if_name );
7165
7169
7166
7170
if (ni_tuple == NULL || PyList_Append (list , ni_tuple ) == -1 ) {
7167
7171
Py_XDECREF (ni_tuple );
0 commit comments