Title: Inconsistency in handling Bluetooth addresses · Issue #132099 · python/cpython · GitHub
Open Graph Title: Inconsistency in handling Bluetooth addresses · Issue #132099 · python/cpython
X Title: Inconsistency in handling Bluetooth addresses · Issue #132099 · python/cpython
Description: Bug report The format accepted by BTPROTO_HCI protocol is incorrectly documented. it accepts a bytes object bdaddr, not a tuple. bdaddr is a bytes object, not a string. Some protocols accept bdaddr as a string, others accept it as a byte...
Open Graph Description: Bug report The format accepted by BTPROTO_HCI protocol is incorrectly documented. it accepts a bytes object bdaddr, not a tuple. bdaddr is a bytes object, not a string. Some protocols accept bdaddr...
X Description: Bug report The format accepted by BTPROTO_HCI protocol is incorrectly documented. it accepts a bytes object bdaddr, not a tuple. bdaddr is a bytes object, not a string. Some protocols accept bdaddr...
Opengraph URL: https://github.com/python/cpython/issues/132099
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistency in handling Bluetooth addresses","articleBody":"# Bug report\n\n1. The format accepted by BTPROTO_HCI protocol is incorrectly documented.\n * it accepts a bytes object `bdaddr`, not a tuple.\n * `bdaddr` is a bytes object, not a string.\n2. Some protocols accept `bdaddr` as a string, others accept it as a bytes object. `getsockname()` returns it as a string or a bytes object, and this is not always consistent with the accepted type.\n3. `getsockname()` not always return an address in the acceptable format. It returns `device_id` when the acceptable format is a tuple `(device_id,)`, can return a string when the acceptable format is a bytes object.\n\nFirst problem should be solved by updating the documentation.\n\nFor second problem, I propose to make both string and bytes be accepted as a Bluetooth address. Also, if a 1-tuple is accepted, then its element should be accepted, and if `bdaddr` is accepted, then a 1-tuple `(bdaddr,)` should be accepted.\n\nThe third problem cannot be resolved in backward compatible way. The solution for the second problem formally fixes incompatibility between input and output formats, but formats are still inconsistent between protocols. And after adding support for `hci_channel` (see #70145), the type of the `getsockname()` result will depend on the `hci_channel` value.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-132118\n* gh-132482\n* gh-132486\n* gh-132497\n* gh-132525\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/serhiy-storchaka","@type":"Person","name":"serhiy-storchaka"},"datePublished":"2025-04-04T18:54:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/132099/cpython/issues/132099"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:25ca0086-201f-7d73-776d-7fb3e3e9e2c2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B1AE:F5661:F9D875:157AF3A:696A9478 |
| html-safe-nonce | cd4dddaa3c1461908c4e8c6c0cc1910b571e7212f83b5e1f62522bafe50c3d25 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMUFFOkY1NjYxOkY5RDg3NToxNTdBRjNBOjY5NkE5NDc4IiwidmlzaXRvcl9pZCI6IjY0ODU0NDU5MjYzMzg1OTgwMDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3760ad79da199586a049bc1b53cfbdbe2b310bf214a5de1ae08bfc5665adba37 |
| hovercard-subject-tag | issue:2973145386 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/132099/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a3a409face45d3acded919b9a0b4ed4a9d9454ae21f6d3c22e87fc06d2456798/python/cpython/issues/132099 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a3a409face45d3acded919b9a0b4ed4a9d9454ae21f6d3c22e87fc06d2456798/python/cpython/issues/132099 |
| og:image:alt | Bug report The format accepted by BTPROTO_HCI protocol is incorrectly documented. it accepts a bytes object bdaddr, not a tuple. bdaddr is a bytes object, not a string. Some protocols accept bdaddr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | serhiy-storchaka |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4dd496afc954da9c207b2d9fbe86e3074619f565754aa1d9274aec30d9e5b8d7 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 31496a13b80a2f6ad77d6c617ee2255a3545b539 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width