Commit 0b4207a2 authored by Stefan Behnel's avatar Stefan Behnel

Use inline properties on the "PyComplex" builtin type declared in...

Use inline properties on the "PyComplex" builtin type declared in "cpython.complex" to provide C level access to the "real" and "imag" attributes (which Cython provides anyway for the 'undeclared' builtin type).
parent 187992df
......@@ -14,9 +14,14 @@ cdef extern from "Python.h":
ctypedef class __builtin__.complex [object PyComplexObject]:
cdef Py_complex cval
# not making these available to keep them read-only:
#cdef double imag "cval.imag"
#cdef double real "cval.real"
@property
cdef inline double real(self):
return self.cval.real
@property
cdef inline double imag(self):
return self.cval.imag
# PyTypeObject PyComplex_Type
# This instance of PyTypeObject represents the Python complex
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment