mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-132099: Accept an integer as the address for BTPROTO_HCI on Linux (GH-132525)
Previously only an integer packed in a tuple was accepted, while getsockname() could return a raw integer. Now the result of getsockname() is always acceptable as an address.
This commit is contained in:
parent
82f74eb234
commit
8cb177d09b
4 changed files with 19 additions and 5 deletions
|
@ -2147,7 +2147,12 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
|
|||
#if defined(HAVE_BLUETOOTH_BLUETOOTH_H)
|
||||
unsigned short dev;
|
||||
unsigned short channel = HCI_CHANNEL_RAW;
|
||||
if (!PyArg_ParseTuple(args, "H|H", &dev, &channel)) {
|
||||
if (PyLong_Check(args)) {
|
||||
if (!PyArg_Parse(args, "H", &dev)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (!PyArg_ParseTuple(args, "H|H", &dev, &channel)) {
|
||||
PyErr_Format(PyExc_OSError,
|
||||
"%s(): wrong format", caller);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue