]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-120726: Fix compiler warnings on is_core_module() (GH-120727) (#120729)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 19 Jun 2024 10:23:28 +0000 (12:23 +0200)
committerGitHub <noreply@github.com>
Wed, 19 Jun 2024 10:23:28 +0000 (10:23 +0000)
gh-120726: Fix compiler warnings on is_core_module() (GH-120727)

Fix compiler warnings on is_core_module() and
check_interpreter_whence(): only define them when
assertions are built.
(cherry picked from commit a816cd67f43d9adb27ccdb6331e08c835247d1df)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Python/import.c
Python/pystate.c

index 8cf97b51f65fecd95b1145ac4b6387e8b5bb405e..005f7692e0c4dcf26627cfa964b86f1498451c82 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)