Opened 5 years ago

Closed 5 years ago

#517 closed enhancement (fixed)

remove dependency on structmember.h

Reported by: dalcinl Owned by: dalcinl
Priority: minor Milestone: 0.13
Component: Code Generation Keywords:
Cc:

Description

We could get rid of structmember.h by using the a code transform to manage cdef public/readonly members via properties.

Pros:

1) structmember.h has no namespace protection using a Py_ prefix for the many 'T_XXX' definitions. This can conflict with user code (BTW, and this issue was reported in cython-users ML).

2) when using PyMemberDef? tables from structmember.h, C <-> Python conversions are outside Cython's control of to_py/from_py converters. Using a transform+property mechanism is more consistent, and actually extend (for free, with no special casing at all) the types that can be made cdef public/readonly members (e.g. complex numbers, C struct's)

Cons:

1) Generated code is less readable and larger

Attachments (1)

cdef_members.diff (23.6 KB) - added by dalcinl 5 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 5 years ago by dalcinl

  • Status changed from new to assigned
  • Summary changed from remove dependency on CPython's structmember.h to remove dependency on structmember.h

Changed 5 years ago by dalcinl

comment:2 Changed 5 years ago by dalcinl

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.