Remove warnings from python loader.
@@ -158,9 +158,9 @@ static value py_loader_impl_error_value_from_exception(loader_impl_py py_impl, P
#if DEBUG_ENABLED
static void py_loader_impl_gc_print(loader_impl_py py_impl);
-#endif
static void py_loader_impl_sys_path_print(PyObject *sys_path_list);
+#endif
static PyObject *py_loader_impl_function_type_invoke(PyObject *self, PyObject *args);
@@ -228,6 +228,12 @@ static struct PyMethodDef py_loader_impl_dict_methods[] = {
{ NULL, NULL, 0, NULL }
};
+union py_loader_impl_dict_cast
+{
+ PyTypeObject *type_object;
+ PyObject *object;
+};
+
static PyTypeObject py_loader_impl_dict_type = {
PyVarObject_HEAD_INIT(NULL, 0) "DictWrapper",
sizeof(struct py_loader_impl_dict_obj),
@@ -329,10 +335,11 @@ void py_loader_impl_dict_dealloc(struct py_loader_impl_dict_obj *self)
PyObject *py_loader_impl_finalizer_wrap_map(PyObject *obj, value v)
{
PyObject *args = PyTuple_New(1);
+ union py_loader_impl_dict_cast dict_cast = { &py_loader_impl_dict_type };
PyTuple_SetItem(args, 0, obj);
Py_INCREF(obj);
- PyObject *wrapper = PyObject_CallObject((PyObject *)&py_loader_impl_dict_type, args);
+ PyObject *wrapper = PyObject_CallObject(dict_cast.object, args);
Py_DECREF(args);
if (wrapper == NULL)
@@ -4156,7 +4163,6 @@ void py_loader_impl_gc_print(loader_impl_py py_impl)
Py_DECREF(separator);
Py_DECREF(garbage_str_obj);
}
-#endif
void py_loader_impl_sys_path_print(PyObject *sys_path_list)
{
@@ -4185,6 +4191,7 @@ void py_loader_impl_sys_path_print(PyObject *sys_path_list)
Py_XDECREF(separator);
}
+#endif
int py_loader_impl_finalize(loader_impl_py py_impl)
{
