gh-96017: Fix some compiler warnings (GH-96018)

- "comparison of integers of different signs" in typeobject.c
- only define static_builtin_index_is_set in DEBUG builds
- only define recreate_gil with ifdef HAVE_FORK
This commit is contained in:
Christian Heimes 2022-08-19 08:08:43 +02:00 committed by GitHub
parent 6740680b57
commit d9c1b746b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -70,11 +70,13 @@ static inline PyTypeObject * subclass_from_ref(PyObject *ref);
/* helpers for for static builtin types */ /* helpers for for static builtin types */
#ifndef NDEBUG
static inline int static inline int
static_builtin_index_is_set(PyTypeObject *self) static_builtin_index_is_set(PyTypeObject *self)
{ {
return self->tp_subclasses != NULL; return self->tp_subclasses != NULL;
} }
#endif
static inline size_t static inline size_t
static_builtin_index_get(PyTypeObject *self) static_builtin_index_get(PyTypeObject *self)

View file

@ -133,12 +133,14 @@ static void destroy_gil(struct _gil_runtime_state *gil)
_Py_ANNOTATE_RWLOCK_DESTROY(&gil->locked); _Py_ANNOTATE_RWLOCK_DESTROY(&gil->locked);
} }
#ifdef HAVE_FORK
static void recreate_gil(struct _gil_runtime_state *gil) static void recreate_gil(struct _gil_runtime_state *gil)
{ {
_Py_ANNOTATE_RWLOCK_DESTROY(&gil->locked); _Py_ANNOTATE_RWLOCK_DESTROY(&gil->locked);
/* XXX should we destroy the old OS resources here? */ /* XXX should we destroy the old OS resources here? */
create_gil(gil); create_gil(gil);
} }
#endif
static void static void
drop_gil(struct _ceval_runtime_state *ceval, struct _ceval_state *ceval2, drop_gil(struct _ceval_runtime_state *ceval, struct _ceval_state *ceval2,