Ticket #590 (closed defect: fixed)
dict.keys/values/items() return lists in -3 mode
| Reported by: | scoder | Owned by: | scoder |
|---|---|---|---|
| Priority: | major | Milestone: | 0.19 |
| Component: | Python3 Semantics | Keywords: | |
| Cc: |
Description
In Python 2, it is correct to replace calls to the dict methods keys(), values() and items() by their faster PyDict_*() C-API equivalents. For Cython language level 2, this is always the right thing to do.
In Python 3, however, the methods return dict views whereas the C-API functions continue to return lists, so when compiling in -3 mode, Cython should not optimise the method calls away to allow access to the dict views when running in Python 3 (even if they are not available in Python 2). There is currently no C-level way to access dict views, so the only way to instantiate them is through the dict methods.
The mapping is currently set up in Builtin.py.
Change History
Note: See
TracTickets for help on using
tickets.
