GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-85302: Add support for BTPROTO_SCO on FreeBSD · python/cpython@2debf1e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Doc/library
    • socket.rst
  • Lib/test
    • test_socket.py
  • Misc/NEWS.d/next/Library
    • 2025-04-01-18-24-58.gh-issue-85302.7knfUf.rst
  • Modules
    • socketmodule.c
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Doc/library/socket.rst‎

Copy file name to clipboardExpand all lines: Doc/library/socket.rst
+4-2Lines changed: 4 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,10 @@ created. Socket addresses are represented as follows:
164164

165165
- :const:`BTPROTO_SCO` accepts ``bdaddr`` where ``bdaddr`` is a
166166
:class:`bytes` object containing the Bluetooth address in a
167-
string format. (ex. ``b'12:23:34:45:56:67'``) This protocol is not
168-
supported under FreeBSD.
167+
string format. (ex. ``b'12:23:34:45:56:67'``)
168+
169+
.. versionchanged:: next
170+
FreeBSD support added.
169171

170172
- :const:`AF_ALG` is a Linux-only socket based interface to Kernel
171173
cryptography. An algorithm socket is configured with a tuple of two to four
Collapse file

‎Lib/test/test_socket.py‎

Copy file name to clipboardExpand all lines: Lib/test/test_socket.py
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,9 +2619,7 @@ def testBluetoothConstants(self):
26192619
socket.BTPROTO_HCI
26202620
socket.SOL_HCI
26212621
socket.BTPROTO_L2CAP
2622-
2623-
if not sys.platform.startswith("freebsd"):
2624-
socket.BTPROTO_SCO
2622+
socket.BTPROTO_SCO
26252623

26262624
def testCreateRfcommSocket(self):
26272625
with socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM) as s:
@@ -2637,8 +2635,7 @@ def testCreateHciSocket(self):
26372635
with socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW, socket.BTPROTO_HCI) as s:
26382636
pass
26392637

2640-
@unittest.skipIf(sys.platform == "win32" or sys.platform.startswith("freebsd"),
2641-
"windows and freebsd do not support SCO sockets")
2638+
@unittest.skipIf(sys.platform == "win32", "windows does not support SCO sockets")
26422639
def testCreateScoSocket(self):
26432640
with socket.socket(socket.AF_BLUETOOTH, socket.SOCK_SEQPACKET, socket.BTPROTO_SCO) as s:
26442641
pass
Collapse file

‎Misc/NEWS.d/next/Library/2025-04-01-18-24-58.gh-issue-85302.7knfUf.rst‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add support for :data:`~socket.BTPROTO_SCO` in sockets on FreeBSD.
Collapse file

‎Modules/socketmodule.c‎

Copy file name to clipboardExpand all lines: Modules/socketmodule.c
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,15 +1536,15 @@ makesockaddr(SOCKET_T sockfd, struct sockaddr *addr, size_t addrlen, int proto)
15361536
return ret;
15371537
#endif
15381538
}
1539+
#endif /* BTPROTO_HCI */
15391540

1540-
#if !defined(__FreeBSD__)
1541+
#ifdef BTPROTO_SCO
15411542
case BTPROTO_SCO:
15421543
{
15431544
struct sockaddr_sco *a = (struct sockaddr_sco *) addr;
15441545
return makebdaddr(&_BT_SCO_MEMB(a, bdaddr));
15451546
}
1546-
#endif /* !__FreeBSD__ */
1547-
#endif /* BTPROTO_HCI */
1547+
#endif /* BTPROTO_SCO */
15481548

15491549
default:
15501550
PyErr_SetString(PyExc_ValueError,
@@ -2149,7 +2149,8 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
21492149
*len_ret = sizeof *addr;
21502150
return 1;
21512151
}
2152-
#if !defined(__FreeBSD__)
2152+
#endif /* BTPROTO_HCI */
2153+
#ifdef BTPROTO_SCO
21532154
case BTPROTO_SCO:
21542155
{
21552156
const char *straddr;
@@ -2168,8 +2169,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
21682169
*len_ret = sizeof *addr;
21692170
return 1;
21702171
}
2171-
#endif /* !__FreeBSD__ */
2172-
#endif /* BTPROTO_HCI */
2172+
#endif /* BTPROTO_SCO */
21732173
default:
21742174
PyErr_Format(PyExc_OSError,
21752175
"%s(): unknown Bluetooth protocol", caller);
@@ -2719,11 +2719,11 @@ getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret)
27192719
case BTPROTO_HCI:
27202720
*len_ret = sizeof (struct sockaddr_hci);
27212721
return 1;
2722-
#if !defined(__FreeBSD__)
2722+
#endif /* BTPROTO_HCI */
2723+
#ifdef BTPROTO_SCO
27232724
case BTPROTO_SCO:
27242725
*len_ret = sizeof (struct sockaddr_sco);
27252726
return 1;
2726-
#endif /* !__FreeBSD__ */
27272727
#endif /* BTPROTO_HCI */
27282728
default:
27292729
PyErr_SetString(PyExc_OSError, "getsockaddrlen: "

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.