From 5c6e7454cf5bafcaa63c4e642a54ee54b0d76eb3 Mon Sep 17 00:00:00 2001 From: Jeremy Cline Date: Thu, 28 Jun 2018 11:08:39 -0400 Subject: [PATCH] Fix redundant declaration of _PyImport_AddModuleObject MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 3f9eee6eb4b2 ("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 --- Include/import.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/Include/import.h b/Include/import.h index 13f32a1004cff5..c664803478a551 100644 --- a/Include/import.h +++ b/Include/import.h @@ -54,9 +54,6 @@ PyAPI_FUNC(PyObject *) PyImport_AddModuleObject( PyObject *name ); #endif -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *, PyObject *); -#endif PyAPI_FUNC(PyObject *) PyImport_AddModule( const char *name /* UTF-8 encoded string */ );