Ticket #170 (closed defect: fixed)
better error when user-declared type conflicts with builtin type
| Reported by: | robertwb | Owned by: | robertwb |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.11.1 |
| Component: | Parsing | Keywords: | |
| Cc: |
Description
The offending code
cdef extern from *:
ctypedef class __builtin__.list [object PyListObject]:
pass
cdef list foo = []
Proposed behavior
On Dec 18, 2008, at 3:53 AM, Muhammad Alkarouri wrote: I suggested to report it according to your earlier suggestion, but I would say the best way forward for Cython is to explicitly deprecate the practice of declaring types that are defined by Cython. Say, cython should fail with a kind of duplicate error or 'new definition overrides cython built in' kind of message. The idea is that: 1. The will be less hairy code and more maintainable for cython developers. 2. For a cython user like me, such a failure would be clear enough to modify the source in accordance. 3. Cython will probably grow more capabilities in types and other optimizations in the future. These may replace user defined ones. If users are used to this kind of change this will give Cython developers more leeway in doing improvements in types and functions. In short, I would fix that by giving a clearer error and also clearly noting that in the documentation. The user should expect to have to delete the offending duplicate type or function. Does that make sense?
Change History
Note: See
TracTickets for help on using
tickets.
