-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Milestone
Description
Going through some of pandas' cython modules to try to make code valid-python where possible, I'm seeing cythonize-time errors. It seems like some combinations are invalid for surprising reasons, e.g:
cpdef object get_rule_month(object source, object default='DEC')
# existing, works as expected
cpdef object get_rule_month(source: object, default: object='DEC'):
# seems OK
cpdef get_rule_month(source: object, default: object='DEC') -> object:
# breaks --> Syntax error in C variable declaration
@cython.ccall
def get_rule_month(source: object, default: object='DEC') -> object:
# breaks --> Exception clause not allowed for function returning Python object
@cython.ccall
def object get_rule_month(source: object, default: object='DEC'):
# breaks --> Expected '(', found 'get_rule_month'
@cython.ccall
@cython.returns(object)
def get_rule_month(source: object, default: object='DEC'):
# appears OK
Another example with a slightly different set of errors:
cdef inline bint is_null_datetime64(v):
# existing, OK
cdef inline is_null_datetime64(v) -> bint:
# breaks --> Syntax error in C variable declaration
@cython.cfunc
def inline is_null_datetime64(v) -> bint:
# breaks --> Expected '(', found 'is_null_datetime64
@cython.cfunc
@cython.inline
def is_null_datetime64(v) -> bint:
# breaks --> Function signature does not match previous declaration
This last one here is the one that is noticeably different from the first example.
Is this behavior intentional?
black-square and schneiderfelipeschneiderfelipeschneiderfelipe