bpo-28280: Make PyMapping_Keys(), PyMapping_Values() and PyMapping_Items() always return a list (#3840)

This commit is contained in:
Oren Milman 2017-10-08 11:17:46 +03:00 committed by Serhiy Storchaka
parent f07e2b64df
commit 0ccc0f6c74
6 changed files with 137 additions and 34 deletions

View file

@ -4306,6 +4306,25 @@ py_w_stopcode(PyObject *self, PyObject *args)
#endif
static PyObject *
get_mapping_keys(PyObject* self, PyObject *obj)
{
return PyMapping_Keys(obj);
}
static PyObject *
get_mapping_values(PyObject* self, PyObject *obj)
{
return PyMapping_Values(obj);
}
static PyObject *
get_mapping_items(PyObject* self, PyObject *obj)
{
return PyMapping_Items(obj);
}
static PyObject *
test_pythread_tss_key_state(PyObject *self, PyObject *args)
{
@ -4573,6 +4592,9 @@ static PyMethodDef TestMethods[] = {
#ifdef W_STOPCODE
{"W_STOPCODE", py_w_stopcode, METH_VARARGS},
#endif
{"get_mapping_keys", get_mapping_keys, METH_O},
{"get_mapping_values", get_mapping_values, METH_O},
{"get_mapping_items", get_mapping_items, METH_O},
{"test_pythread_tss_key_state", test_pythread_tss_key_state, METH_VARARGS},
{NULL, NULL} /* sentinel */
};