Need to change syntax for pxd function typing
|Reported by:||dagss||Owned by:||dagss, robertwb|
The new inline pxd functions conflicts in syntax with the recently introduced method of having a pure Python function in the .py file and the types for the function in a corresponding pxd file. Cython 0.11 should not be released without fixing the syntax we want to support for the future so I made this a blocker.
The scheme settled on in mailing list:
> > I'm generally -1 on adding new syntax, but what I had wasn't very > > clear either. Would it be enough to accept a locals decorator? I think that's a very clean compromise. You can a) specify the signature in .pxd files as you would in .pyx files, just without a function body. b) write importable inline functions in .pxd files as a function with body, just as you would in a .pyx file. c) specify local variable types for a .py implemented function in a .pxd file by adding a decorator to a function signature, but without providing a function body. So, whenever a function signature in a .pxd file has a body at all, it must be a complete inline function. I actually don't think that users would intuitively expect the current way of defining local variables in .pxd files to work.
Note that this may require extending decorator support (in Parsing.py) to cdef functions. They should all probably simply be let through, and then disallowed again (except for @cython.locals) in PostParse?.
Change History (11)
Changed 6 years ago by dagss
comment:8 Changed 6 years ago by scoder
- Resolution fixed deleted
- Status changed from closed to reopened
comment:9 Changed 6 years ago by scoder
- Owner changed from somebody to dagss, robertwb
- Status changed from reopened to new