◐ Shell
clean mode source ↗

bpo-28411: Fix redundant declaration of _PyImport_AddModuleObject by jeremycline · Pull Request #7992 · python/cpython

Commit 3f9eee6 ("bpo-28411: Support other mappings in
PyInterpreterState.modules.") introduced a new warning when building a C
extension with GCC and Python 3.7:

    In file included from /usr/include/python3.7m/Python.h:126,
                     from /home/me/linux/packaging/tools/perf/util/python.c:2:
    /usr/include/python3.7m/import.h:58:24: error: redundant redeclaration of
        ‘_PyImport_AddModuleObject’ [-Werror=redundant-decls]
     PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *, PyObject *);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/python3.7m/import.h:47:24: note: previous declaration of
        ‘_PyImport_AddModuleObject’ was here
     PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *name,
                            ^~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    error: command 'gcc' failed with exit status 1

Both _PyImport_AddModuleObject declarations are within #ifndef Py_LIMITED_API
conditional block so drop one of them.

Signed-off-by: Jeremy Cline <jeremy@jcline.org>

ericsnowcurrently

@jeremycline jeremycline changed the title Fix redundant declaration of _PyImport_AddModuleObject bpo-28411: Fix redundant declaration of _PyImport_AddModuleObject

Jun 29, 2018

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Jun 29, 2018
(cherry picked from commit f874bd1)

Co-authored-by: Jeremy Cline <jeremy@jcline.org>

miss-islington added a commit that referenced this pull request

Jun 29, 2018
(cherry picked from commit f874bd1)

Co-authored-by: Jeremy Cline <jeremy@jcline.org>