This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Fix compiling the socket module on NetBSD 8 and other issues
Type: compile error Stage: resolved
Components: Extension Modules Versions: Python 3.7, Python 3.6, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: serhiy.storchaka
Priority: normal Keywords: patch

Created on 2017-11-02 16:15 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 4235 merged serhiy.storchaka, 2017-11-02 16:31
PR 4352 merged serhiy.storchaka, 2017-11-09 17:23
PR 4355 merged serhiy.storchaka, 2017-11-09 20:17
Messages (4)
msg305439 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-02 16:15
NetBSD 8 adds support of AF_CAN (previously it was supported only on Linux). This causes a compilation error in socketmodule.c, because AF_CAN is defined in sys/socket.h, but sys/socket.h itself doesn't contain all necessary definitions for handling AF_CAN addresses. This also exposed other errors. The braces are not balanced if AF_CAN is defined, but CAN_RAW and CAN_BCM are not. PyBytes_AS_STRING() is called for non-bytes.

The proposed patch balances #ifdef/#endif with braces, undefines AF_CAN if it is not usable (following the practice for other AF_* constants), separates support of CAN_RAW and CAN_BCM (only the former is defined on NetBSD 8), adds comments to #endif for helping with navigation, adds the const qualifier to char pointers that always point to constant data, fixes indentation.

This fixed a compilation on NetBSD 8, and I hope this will fix a compilation on other platforms that will add AF_CAN. In a separate issue I'll add a support of AF_CAN on NetBSD (in 3.7 only).
msg305969 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-09 16:00
New changeset d3187158c09cf899e9849f335bdff10594209167 by Serhiy Storchaka in branch 'master':
bpo-31927: Fix bugs in socketmodule.c on NetBSD and other issues. (#4235)
msg305982 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-09 19:40
New changeset 596286f8f3c8e53ef010d6298464775dc900a515 by Serhiy Storchaka in branch '3.6':
[3.6] bpo-31927: Fix bugs in socketmodule.c on NetBSD and other issues. (GH-4235) (#4352)
msg305983 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-09 21:06
New changeset 1bce4efdb4624561adce62e544dbe20ec2627ae2 by Serhiy Storchaka in branch '2.7':
[2.7] bpo-31927: Fix reading arbitrary data when parse a AF_BLUETOOTH address (GH-4235) (GH-4352) (#4355)
Date User Action Args
2022-04-11 14:58:54adminsetgithub: 76108
2017-11-09 21:26:48serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-11-09 21:06:01serhiy.storchakasetmessages: + msg305983
2017-11-09 20:17:13serhiy.storchakasetpull_requests: + pull_request4310
2017-11-09 19:40:32serhiy.storchakasetmessages: + msg305982
2017-11-09 17:23:51serhiy.storchakasetpull_requests: + pull_request4308
2017-11-09 16:00:41serhiy.storchakasetmessages: + msg305969
2017-11-02 16:37:13serhiy.storchakalinkissue30512 dependencies
2017-11-02 16:31:02serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request4202
2017-11-02 16:15:22serhiy.storchakacreate