[3.13] gh-120726: Fix compiler warnings on is_core_module() (GH-120727) (#120729)

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 a816cd67f4)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
This commit is contained in:
Miss Islington (bot) 2024-06-19 12:23:28 +02:00 committed by GitHub
parent 9be94f9ce6
commit 071b66b218
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -1551,6 +1551,7 @@ get_core_module_dict(PyInterpreterState *interp,
return NULL; return NULL;
} }
#ifndef NDEBUG
static inline int static inline int
is_core_module(PyInterpreterState *interp, PyObject *name, PyObject *path) 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 static _Py_ext_module_kind
_get_extension_kind(PyModuleDef *def, bool check_size) _get_extension_kind(PyModuleDef *def, bool check_size)
{ {

View file

@ -584,9 +584,9 @@ free_interpreter(PyInterpreterState *interp)
PyMem_RawFree(interp); PyMem_RawFree(interp);
} }
} }
#ifndef NDEBUG
static inline int check_interpreter_whence(long); static inline int check_interpreter_whence(long);
#endif
/* Get the interpreter state to a minimal consistent state. /* Get the interpreter state to a minimal consistent state.
Further init happens in pylifecycle.c before it can be used. Further init happens in pylifecycle.c before it can be used.
All fields not initialized here are expected to be zeroed out, All fields not initialized here are expected to be zeroed out,
@ -1130,7 +1130,7 @@ _PyInterpreterState_IsReady(PyInterpreterState *interp)
return interp->_ready; return interp->_ready;
} }
#ifndef NDEBUG
static inline int static inline int
check_interpreter_whence(long whence) check_interpreter_whence(long whence)
{ {
@ -1142,6 +1142,7 @@ check_interpreter_whence(long whence)
} }
return 0; return 0;
} }
#endif
long long
_PyInterpreterState_GetWhence(PyInterpreterState *interp) _PyInterpreterState_GetWhence(PyInterpreterState *interp)