Ticket #258 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

redeclaration of builtin types, followup for #170

Reported by: robertwb Owned by: somebody
Priority: major Milestone: 0.12.1
Component: Type Analysis Keywords:
Cc:

Description (last modified by robertwb) (diff)


Change History

Changed 4 years ago by robertwb

More work needs to be done to allow subclassing/attribute access from builtin types. See #170.

Changed 4 years ago by scoder

  • owner set to somebody
  • component changed from Error Reporting to Type Analysis

Pyrex is supposed to handle the subtyping part correctly, so this needs a port.

 http://comments.gmane.org/gmane.comp.python.cython.devel/5552

Changed 4 years ago by scoder

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

Changed 4 years ago by scoder

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

... running out of time before even getting started.

The relevant commits in Pyrex are at revision 26-37 in  http://hg.cython.org/pyrex/

Porting this will likely interfere with Cython's builtin caching feature, although that might become redundant in many cases. True/False handling is another thing that works different in Cython now, so that must be left out.

Changed 4 years ago by scoder

  • milestone changed from 0.12 to 0.13

This isn't trivial, so it won't happen for 0.12, I guess.

Changed 3 years ago by robertwb

  • status changed from new to closed
  • resolution set to fixed
  • description modified (diff)
  • milestone changed from 0.13 to 0.12.1

Changed 3 years ago by robertwb

  • description modified (diff)

There is now a warning for redecoration of builtin types. This creates a new type, on the same level with all other extern types, which may have attributes and accept subclasses, and does *not* perform the optimizations associated with the builtin one. Assignment from the builtin type is allowed, e.g.

cdef extern from "Python.h":
    ctypedef class __builtin__.list  [object PyListObject]:
        cdef Py_ssize_t allocated

cdef list L = [1,2,4]
print L. allocated

Such redeclarations are still discouraged.

 http://hg.cython.org/cython-devel/rev/64ffae746f98

 http://hg.cython.org/cython-devel/rev/2de0e2c7a09a

Note: See TracTickets for help on using tickets.