Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-96017: Fix some compiler warnings
- "comparison of integers of different signs" in typeobject.c
- only define static_builtin_index_is_set in DEBUG builds
- unset NDEBUG before including assert.h
- only define recreate_gil with ifdef HAVE_FORK
  • Loading branch information
tiran committed Aug 16, 2022
commit 83a0cd0e82f7695b1bb43aa6d86261d7a4594f2c
8 changes: 5 additions & 3 deletions Modules/_testcapi/parts.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "Python.h"

/* Always enable assertions */
#undef NDEBUG
#ifdef NDEBUG
# undef NDEBUG
Comment thread
tiran marked this conversation as resolved.
Outdated
#endif

#include "Python.h"

int _PyTestCapi_Init_Vectorcall(PyObject *module);
int _PyTestCapi_Init_VectorcallLimited(PyObject *module);
Expand Down
4 changes: 3 additions & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ static inline PyTypeObject * subclass_from_ref(PyObject *ref);

/* helpers for for static builtin types */

#ifndef NDEBUG
static inline int
static_builtin_index_is_set(PyTypeObject *self)
{
return self->tp_subclasses != NULL;
}
#endif

static inline size_t
static_builtin_index_get(PyTypeObject *self)
Expand Down Expand Up @@ -6802,7 +6804,7 @@ type_ready_post_checks(PyTypeObject *type)
return -1;
}
}
else if (type->tp_dictoffset < sizeof(PyObject)) {
else if (type->tp_dictoffset < (Py_ssize_t)sizeof(PyObject)) {
if (type->tp_dictoffset + type->tp_basicsize <= 0) {
PyErr_Format(PyExc_SystemError,
"type %s has a tp_dictoffset that is too small");
Expand Down
2 changes: 2 additions & 0 deletions Python/ceval_gil.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,14 @@ static void destroy_gil(struct _gil_runtime_state *gil)
_Py_ANNOTATE_RWLOCK_DESTROY(&gil->locked);
}

#ifdef HAVE_FORK
static void recreate_gil(struct _gil_runtime_state *gil)
{
_Py_ANNOTATE_RWLOCK_DESTROY(&gil->locked);
/* XXX should we destroy the old OS resources here? */
create_gil(gil);
}
#endif

static void
drop_gil(struct _ceval_runtime_state *ceval, struct _ceval_state *ceval2,
Expand Down