Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-37879: Fix warnings in _testcapimodule #16004

Merged
merged 2 commits into from
Sep 12, 2019
Merged
Changes from all commits
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
13 changes: 7 additions & 6 deletions Modules/_testcapimodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -6205,7 +6205,7 @@ static PyType_Slot HeapGcCType_slots[] = {
{Py_tp_init, heapctype_init},
{Py_tp_members, heapctype_members},
{Py_tp_dealloc, heapgcctype_dealloc},
{Py_tp_doc, heapgctype__doc__},
{Py_tp_doc, (char*)heapgctype__doc__},
{0, 0},
};

Expand Down Expand Up @@ -6233,7 +6233,7 @@ static PyType_Slot HeapCType_slots[] = {
{Py_tp_init, heapctype_init},
{Py_tp_members, heapctype_members},
{Py_tp_dealloc, heapctype_dealloc},
{Py_tp_doc, heapctype__doc__},
{Py_tp_doc, (char*)heapctype__doc__},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{Py_tp_doc, (void*)s__doc__},

There are some cases that handling type casting with Py_tp_doc
They are using void*. How about casting to void*?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either will work.
Ideally we'd want all the slots to be const, but some of them are PyObjects with mutable refcounts :(

{0, 0},
};

Expand Down Expand Up @@ -6274,7 +6274,7 @@ static struct PyMemberDef heapctypesubclass_members[] = {
static PyType_Slot HeapCTypeSubclass_slots[] = {
{Py_tp_init, heapctypesubclass_init},
{Py_tp_members, heapctypesubclass_members},
{Py_tp_doc, heapctypesubclass__doc__},
{Py_tp_doc, (char*)heapctypesubclass__doc__},
{0, 0},
};

Expand Down Expand Up @@ -6303,7 +6303,8 @@ heapctypesubclasswithfinalizer_init(PyObject *self, PyObject *args, PyObject *kw
static void
heapctypesubclasswithfinalizer_finalize(PyObject *self)
{
PyObject *error_type, *error_value, *error_traceback, *m, *oldtype, *newtype;
PyObject *error_type, *error_value, *error_traceback, *m;
PyObject *oldtype = NULL, *newtype = NULL;

/* Save the current exception, if any. */
PyErr_Fetch(&error_type, &error_value, &error_traceback);
Expand Down Expand Up @@ -6342,7 +6343,7 @@ static PyType_Slot HeapCTypeSubclassWithFinalizer_slots[] = {
{Py_tp_init, heapctypesubclasswithfinalizer_init},
{Py_tp_members, heapctypesubclass_members},
{Py_tp_finalize, heapctypesubclasswithfinalizer_finalize},
{Py_tp_doc, heapctypesubclasswithfinalizer__doc__},
{Py_tp_doc, (char*)heapctypesubclasswithfinalizer__doc__},
{0, 0},
};

Expand Down Expand Up @@ -6372,7 +6373,7 @@ static PyTypeObject MethInstance_Type = {
.tp_new = PyType_GenericNew,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_methods = meth_instance_methods,
.tp_doc = PyDoc_STR(
.tp_doc = (char*)PyDoc_STR(
"Class with normal (instance) methods to test calling conventions"),
};

Expand Down