Skip to content

Conversation

@Divyanshudevtalla
Copy link

Added new Bluetooth constants for Python 3.14 as requested by @dlech.

Updated _Address type alias.

Added Linux and Windows constants.

Followed the ordering from PR #15209 as suggested.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@dlech
Copy link

dlech commented Jan 27, 2026

This is missing changes similar to:

# Bluetooth constants which aren't on the GitHub Actions runners, see #15207
(_?socket\.AF_BLUETOOTH)?
(_?socket\.BDADDR_ANY)?
(_?socket\.BDADDR_LOCAL)?
(_?socket\.BTPROTO_HCI)?
(_?socket\.BTPROTO_L2CAP)?
(_?socket\.BTPROTO_RFCOMM)?
(_?socket\.BTPROTO_SCO)?

@dlech
Copy link

dlech commented Jan 27, 2026

This is also missing modifications to stdlib/socket.pyi.

@dlech
Copy link

dlech commented Jan 27, 2026

It would also be helpful if you could try running a BSD in a virtual machine and check out the constants added there.

# AF_NETLINK, AF_TIPC) or strings/buffers (AF_UNIX).
# See getsockaddrarg() in socketmodule.c.
_Address: TypeAlias = tuple[Any, ...] | str | ReadableBuffer
_Address: TypeAlias = tuple[Any, ...] | str | ReadableBuffer | int
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above should be modified to explain why int is included.

Comment on lines +38 to +39
SOCK_CLOEXEC: Final[int]
SOCK_NONBLOCK: Final[int]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two should not be changed to have a condition on the Python version.

if sys.version_info >= (3, 14):
SOCK_CLOEXEC: Final[int]
SOCK_NONBLOCK: Final[int]
BDADDR_BREDR: Final[int]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect all of the Bluetooth stuff to be grouped together with the existing "semi-documented constants" below line 635.

# Semi-documented constants

Same comment applies to the Windows-only constants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants