[New-bugs-announce] [issue31927] Fix compiling the socket module on NetBSD 8 and other issues

Serhiy Storchaka report at bugs.python.org
Thu Nov 2 12:15:22 EDT 2017


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

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).

----------
assignee: serhiy.storchaka
components: Extension Modules
messages: 305439
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Fix compiling the socket module on NetBSD 8 and other issues
type: compile error
versions: Python 2.7, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31927>
_______________________________________


More information about the New-bugs-announce mailing list