8000 bpo-37879: Suppress subtype_dealloc decref when base type is a C heap type by eduardo-elizondo · Pull Request #15323 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-37879: Suppress subtype_dealloc decref when base type is a C heap type #15323

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

Merged
merged 11 commits into from
Sep 11, 2019
Prev Previous commit
Next Next commit
Merge branch 'master' into fix-cheaptype-subclass
  • Loading branch information
eduardo-elizondo authored Sep 11, 2019
commit 152aeaae096587ff1a7593900bdf07fae552361f
67 changes: 67 additions & 0 deletions Modules/_testcapimodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -6353,6 +6353,73 @@ static PyType_Spec HeapCTypeSubclassWithFinalizer_spec = {
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_FINALIZE,
HeapCTypeSubclassWithFinalizer_slots
};
=======
static PyMethodDef meth_instance_methods[] = {
{"meth_varargs", meth_varargs, METH_VARARGS},
{"meth_varargs_keywords", (PyCFunction)(void(*)(void))meth_varargs_keywords, METH_VARARGS|METH_KEYWORDS},
{"meth_o", meth_o, METH_O},
{"meth_noargs", meth_noargs, METH_NOARGS},
{"meth_fastcall", (PyCFunction)(void(*)(void))meth_fastcall, METH_FASTCALL},
{"meth_fastcall_keywords", (PyCFunction)(void(*)(void))meth_fastcall_keywords, METH_FASTCALL|METH_KEYWORDS},
{NULL, NULL} /* sentinel */
};


static PyTypeObject MethInstance_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"MethInstance",
sizeof(PyObject),
.tp_new = PyType_GenericNew,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_methods = meth_instance_methods,
.tp_doc = PyDoc_STR(
"Class with normal (instance) methods to test calling conventions"),
};

static PyMethodDef meth_class_methods[] = {
{"meth_varargs", meth_varargs, METH_VARARGS|METH_CLASS},
{"meth_varargs_keywords", (PyCFunction)(void(*)(void))meth_varargs_keywords, METH_VARARGS|METH_KEYWORDS|METH_CLASS},
{"meth_o", meth_o, METH_O|METH_CLASS},
{"meth_noargs", meth_noargs, METH_NOARGS|METH_CLASS},
{"meth_fastcall", (PyCFunction)(void(*)(void))meth_fastcall, METH_FASTCALL|METH_CLASS},
{"meth_fastcall_keywords", (PyCFunction)(void(*)(void))meth_fastcall_keywords, METH_FASTCALL|METH_KEYWORDS|METH_CLASS},
{NULL, NULL} /* sentinel */
};


static PyTypeObject MethClass_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"MethClass",
sizeof(PyObject),
.tp_new = PyType_GenericNew,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_methods = meth_class_methods,
.tp_doc = PyDoc_STR(
"Class with class methods to test calling conventions"),
};

static PyMethodDef meth_static_methods[] = {
{"meth_varargs", meth_varargs, METH_VARARGS|METH_STATIC},
{"meth_varargs_keywords", (PyCFunction)(void(*)(void))meth_varargs_keywords, METH_VARARGS|METH_KEYWORDS|METH_STATIC},
{"meth_o", meth_o, METH_O|METH_STATIC},
{"meth_noargs", meth_noargs, METH_NOARGS|METH_STATIC},
{"meth_fastcall", (PyCFunction)(void(*)(void))meth_fastcall, METH_FASTCALL|METH_STATIC},
{"meth_fastcall_keywords", (PyCFunction)(void(*)(void))meth_fastcall_keywords, METH_FASTCALL|METH_KEYWORDS|METH_STATIC},
{NULL, NULL} /* sentinel */
};


static PyTypeObject MethStatic_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"MethStatic",
sizeof(PyObject),
.tp_new = PyType_GenericNew,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_methods = meth_static_methods,
.tp_doc = PyDoc_STR(
"Class with static methods to test calling conventions"),
};


static struct PyModuleDef _testcapimodule = {
PyModuleDef_HEAD_INIT,
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0