Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
2dcc160b
Commit
2dcc160b
authored
Feb 15, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix long-standing bug that dict.items() etc. returned lists also in Py3
parent
15c78db1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
7 deletions
+58
-7
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+9
-6
Cython/Utility/Optimize.c
Cython/Utility/Optimize.c
+48
-0
tests/run/dict_values_in_expression.pyx
tests/run/dict_values_in_expression.pyx
+1
-1
No files found.
Cython/Compiler/Builtin.py
View file @
2dcc160b
...
...
@@ -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'
),
...
...
Cython/Utility/Optimize.c
View file @
2dcc160b
...
...
@@ -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
,
...
...
tests/run/dict_values_in_expression.pyx
View file @
2dcc160b
...
...
@@ -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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment