Ticket #590 (closed defect: fixed)

Opened 3 years ago

Last modified 2 months ago

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

Changed 3 years ago by scoder

  • component changed from Python Semantics to Python3 Semantics

Changed 2 months ago by scoder

  • owner set to scoder
  • status changed from new to assigned

Changed 2 months ago by scoder

  • status changed from assigned to closed
  • resolution set to fixed
  • milestone changed from wishlist to 0.19
Note: See TracTickets for help on using tickets.