Message 323640 - Python tracker

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.

Content
It seems like an oversight of the author, though it is not clear why this happily compiles with clang 3.4.1 on FreeBSD 10.4-STABLE and GCC on RHEL6.

The error is (HP-UX 11.31 and HP C/aC++ B3910B A.06.28.03 [Dec 13 2016]):

> /opt/aCC/bin/cc -Ae +z -O -I./Include -I. -I/usr/local/include -I/var/osipovmi/cpython/Include -I/var/osipovmi/cpython -c /var/osipovmi/cpython/Modules/selectmodule.c -o build/temp.hp-ux-B.11.31-ia64-3.8-pydebug/var/osipovmi/cpython/Modules/selectmodule.o
> "/var/osipovmi/cpython/Modules/selectmodule.c", line 412: warning #4232-D:
>           conversion from "PyObject *" to a more strictly aligned type
>           "PyDictObject *" may cause misaligned access
>       self->ufd_len = PyDict_GET_SIZE(self->dict);
>                       ^
> 
> "/var/osipovmi/cpython/Modules/selectmodule.c", line 849: error #2130:
>           expected a "{"
>   static PyObject *
>   ^
> 
> "/var/osipovmi/cpython/Modules/selectmodule.c", line 898: error #2101:
>           "timeout_obj" has already been declared in the current scope
>       PyObject *result_list = NULL, *timeout_obj = NULL;
>                                      ^
> 
> 2 errors detected in the compilation of "/var/osipovmi/cpython/Modules/selectmodule.c".


caused by:

> +static PyObject *
> +select_devpoll_modify_impl(devpollObject *self, int fd,
> +                           unsigned short eventmask)
> +/*[clinic end generated code: output=bc2e6d23aaff98b4 input=f0d7de3889cc55fb]*/
>  static PyObject *
>  devpoll_modify(devpollObject *self, PyObject *args)
>  {
> -    return internal_devpoll_register(self, args, 1);
> +    return internal_devpoll_register(self, fd, eventmask, 1);
>  }

Signature change, but prototype has not been changed.

>  static PyObject *
> -poll_poll(pollObject *self, PyObject *args)
> +select_poll_poll_impl(pollObject *self, PyObject *timeout_obj)
> +/*[clinic end generated code: output=876e837d193ed7e4 input=7a446ed45189e894]*/
>  {
> -    PyObject *result_list = NULL, *timeout_obj = NULL;
> +    PyObject *result_list = NULL;
>      int poll_result, i, j;
>      PyObject *value = NULL, *num = NULL;
>      _PyTime_t timeout = -1, ms = -1, deadline = 0;
>      int async_err = 0;
> 
> -    if (!PyArg_ParseTuple(args, "|O:poll", &timeout_obj)) {
> -        return NULL;
> -    }
> -
> -    if (timeout_obj != NULL && timeout_obj != Py_None) {
> +    if (timeout_obj != Py_None) {

timeout_obj has been added to the function signature, but the internal NULL assignment has not been removed.