FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-132099: Harmonize Bluetooth address handling by serhiy-storchaka · Pull Request #132486 · python/cpython · GitHub

/ cpython Public

gh-132099: Harmonize Bluetooth address handling - #132486

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:bluetooth-addr-type
Apr 14, 2025
Merged

gh-132099: Harmonize Bluetooth address handling#132486
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:bluetooth-addr-type

Conversation

serhiy-storchaka commented Apr 13, 2025
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

Now all protocols always accept the Bluetooth address as string and getsockname() always returns the Bluetooth address as string.

  • BTPROTO_SCO now accepts not only bytes, but str.
  • BTPROTO_SCO now checks address for embedded null.
  • On *BSD, BTPROTO_HCI now accepts str instead of bytes.
  • On FreeBSD, getsockname() for BTPROTO_HCI now returns str instead of bytes.
  • On NetBSD and DragonFly BDS, BTPROTO_HCI now checks address for embedded null.

📚 Documentation preview 📚: https://cpython-previews--132486.org.readthedocs.build/

Copy link
Copy Markdown
Member Author

Since BTPROTO_HCI support on FreeBSD and all protocols on other BSD did not work just days ago, it is safe to do changes which otherwise could be considered breaking (changing the type of accepting or returning address).

BTPROTO_SCO was the only protocol that worked (only on Linux) with bytes addresses in older versions. Now it accepts both str and bytes.

Now all protocols always accept the Bluetooth address as string and
getsockname() always returns the Bluetooth address as string.

* BTPROTO_SCO now accepts not only bytes, but str.
* BTPROTO_SCO now checks address for embedded null.
* On *BSD, BTPROTO_HCI now accepts str instead of bytes.
* On FreeBSD, getsockname() for BTPROTO_HCI now returns str instead of bytes.
* On NetBSD and DragonFly BDS, BTPROTO_HCI now checks address for embedded null.
gpshead added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 13, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @gpshead for commit 5552a33 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F132486%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 13, 2025

Copy link
Copy Markdown
Member Author

I tested on NetBSD and FreeBSD. Unfortunately, on FreeBSD all tests are skipped, so we can only hope that the code is correct.

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 1fc1df8dcc7a853b0649bc8df37cd07cbd2b6230 3.13

serhiy-storchaka deleted the bluetooth-addr-type branch April 14, 2025 05:59
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Apr 14, 2025
…H-132486)

Now all protocols always accept the Bluetooth address as string and
getsockname() always returns the Bluetooth address as string.

* BTPROTO_SCO now accepts not only bytes, but str.
* BTPROTO_SCO now checks address for embedded null.
* On *BSD, BTPROTO_HCI now accepts str instead of bytes.
* On FreeBSD, getsockname() for BTPROTO_HCI now returns str instead of bytes.
* On NetBSD and DragonFly BDS, BTPROTO_HCI now checks address for embedded null.
(cherry picked from commit 1fc1df8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

bedevere-app Bot commented Apr 14, 2025

Copy link
Copy Markdown

GH-132497 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Apr 14, 2025
serhiy-storchaka added a commit that referenced this pull request Apr 14, 2025
…H-132497)

Now all protocols always accept the Bluetooth address as string and
getsockname() always returns the Bluetooth address as string.

* BTPROTO_SCO now accepts not only bytes, but str.
* BTPROTO_SCO now checks address for embedded null.
* On *BSD, BTPROTO_HCI now accepts str instead of bytes.
* On FreeBSD, getsockname() for BTPROTO_HCI now returns str instead of bytes.
* On NetBSD and DragonFly BSD, BTPROTO_HCI now checks address for embedded null.
(cherry picked from commit 1fc1df8)
serhiy-storchaka removed their assignment Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL