Ticket #425 (closed enhancement: fixed)
Drop redundant ref-counting on parallel swap assignments
| Reported by: | scoder | Owned by: | scoder |
|---|---|---|---|
| Priority: | major | Milestone: | 0.12 |
| Component: | Optimization | Keywords: | |
| Cc: |
Description
The ref-counting for parallel swap assignments is redundant, i.e.
cdef object a = ..., b = ... a,b = b,a
should be a simple pointer exchange through a temp variable. The same applies to swapping list or buffer items. The general rules are:
- the sets of names/expressions on both sides must be identical
- no value must appear more than once on either side, i.e. this must be prohibited: a,b,b = a,a,b
- all values on both sides of an assignment must have Python object types
- attribute access is only allowed at the C level, i.e. no Python attributes or properties
- item access (indexing) is only allowed for C types, including buffers and Python lists
Change History
Note: See
TracTickets for help on using
tickets.
