Commit 2dcc160b authored by Stefan Behnel's avatar Stefan Behnel

fix long-standing bug that dict.items() etc. returned lists also in Py3

parent 15c78db1
......@@ -281,12 +281,15 @@ builtin_types_table = [
utility_code=UtilityCode.load("ListAppend", "Optimize.c")),
]),
("dict", "PyDict_Type", [BuiltinMethod("items", "T", "O", "PyDict_Items"), # FIXME: Py3 mode?
BuiltinMethod("keys", "T", "O", "PyDict_Keys"), # FIXME: Py3 mode?
BuiltinMethod("values","T", "O", "PyDict_Values"), # FIXME: Py3 mode?
BuiltinMethod("clear", "T", "r", "__Pyx_PyDict_Clear",
utility_code = UtilityCode.load("py_dict_clear", "Optimize.c")),
BuiltinMethod("copy", "T", "T", "PyDict_Copy")]),
("dict", "PyDict_Type", [BuiltinMethod("items", "T", "O", "__Pyx_PyDict_Items",
utility_code=UtilityCode.load("py_dict_items", "Optimize.c")),
BuiltinMethod("keys", "T", "O", "__Pyx_PyDict_Keys",
utility_code=UtilityCode.load("py_dict_keys", "Optimize.c")),
BuiltinMethod("values", "T", "O", "__Pyx_PyDict_Values",
utility_code=UtilityCode.load("py_dict_values", "Optimize.c")),
BuiltinMethod("clear", "T", "r", "__Pyx_PyDict_Clear",
utility_code=UtilityCode.load("py_dict_clear", "Optimize.c")),
BuiltinMethod("copy", "T", "T", "PyDict_Copy")]),
("slice", "PySlice_Type", [BuiltinAttribute('start'),
BuiltinAttribute('stop'),
......
......@@ -353,6 +353,54 @@ static PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *d
#define __Pyx_PyDict_Clear(d) (PyDict_Clear(d), 0)
//////////////////// py_dict_keys.proto ////////////////////
#if PY_MAJOR_VERSION >= 3
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d); /*proto*/
#else
#define __Pyx_PyDict_Keys(d) PyDict_Keys(d)
#endif
//////////////////// py_dict_keys ////////////////////
#if PY_MAJOR_VERSION >= 3
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
return PyObject_CallMethodObjArgs(d, PYIDENT("keys"), NULL);
}
#endif
//////////////////// py_dict_values.proto ////////////////////
#if PY_MAJOR_VERSION >= 3
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); /*proto*/
#else
#define __Pyx_PyDict_Values(d) PyDict_Values(d)
#endif
//////////////////// py_dict_values ////////////////////
#if PY_MAJOR_VERSION >= 3
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
return PyObject_CallMethodObjArgs(d, PYIDENT("values"), NULL);
}
#endif
//////////////////// py_dict_items.proto ////////////////////
#if PY_MAJOR_VERSION >= 3
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /*proto*/
#else
#define __Pyx_PyDict_Items(d) PyDict_Items(d)
#endif
//////////////////// py_dict_items ////////////////////
#if PY_MAJOR_VERSION >= 3
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
return PyObject_CallMethodObjArgs(d, PYIDENT("items"), NULL);
}
#endif
/////////////// dict_iter.proto ///////////////
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
......
......@@ -4,7 +4,7 @@ def values_in_expression(**kwargs):
>>> sorted(values_in_expression(a=3, b=4))
[1, 2, 3, 4]
"""
return [ arg for arg in [1,2] + kwargs.values() ]
return [ arg for arg in [1,2] + list(kwargs.values()) ]
cdef dict make_dict(d):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment