]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-120726: Fix compiler warnings on is_core_module() (#120727)
authorKirill Podoprigora <kirill.bast9@mail.ru>
Wed, 19 Jun 2024 07:46:04 +0000 (10:46 +0300)
committerGitHub <noreply@github.com>
Wed, 19 Jun 2024 07:46:04 +0000 (07:46 +0000)
Fix compiler warnings on is_core_module() and
check_interpreter_whence(): only define them when
assertions are built.

Python/import.c
Python/pystate.c

index 932881950d7baa75cce26439745fb7f73a544596..b7e2c3eb0e0f7e10f92ace1cc61b014102601851 100644 (file)
@@ -1551,6 +1551,7 @@ get_core_module_dict(PyInterpreterState *interp,
     return NULL;
 }
 
+#ifndef NDEBUG
 static inline int
 is_core_module(PyInterpreterState *interp, PyObject *name, PyObject *path)
 {
@@ -1568,7 +1569,6 @@ is_core_module(PyInterpreterState *interp, PyObject *name, PyObject *path)
 }
 
 
-#ifndef NDEBUG
 static _Py_ext_module_kind
 _get_extension_kind(PyModuleDef *def, bool check_size)
 {
index e1a95907b57d20b8bfe793d66b4fc1f894f2bb49..8d31a4db200d74e010a82c27b300afb37e40ef04 100644 (file)
@@ -584,9 +584,9 @@ free_interpreter(PyInterpreterState *interp)
         PyMem_RawFree(interp);
     }
 }
-
+#ifndef NDEBUG
 static inline int check_interpreter_whence(long);
-
+#endif
 /* Get the interpreter state to a minimal consistent state.
    Further init happens in pylifecycle.c before it can be used.
    All fields not initialized here are expected to be zeroed out,
@@ -1130,7 +1130,7 @@ _PyInterpreterState_IsReady(PyInterpreterState *interp)
     return interp->_ready;
 }
 
-
+#ifndef NDEBUG
 static inline int
 check_interpreter_whence(long whence)
 {
@@ -1142,6 +1142,7 @@ check_interpreter_whence(long whence)
     }
     return 0;
 }
+#endif
 
 long
 _PyInterpreterState_GetWhence(PyInterpreterState *interp)