Hi all, Just found an odd bug, which occurs with both Python 3.4.3 / Cython 0.23.4 and Python 2.7.10 / Cython 0.22.1 (the versions that happen to be on my machine).
Specifically, a cython function with a fused type *and* a keyword argument in its signature will cause a segfault when its __kwdefaults__ attribute is looked up. (Which happens if, say, you try to get the function documentation in python via "function?", or otherwise do any inspection...) Example: foo.pyx ----- ctypedef fused FUSED: float int def foo(FUSED bar, baz=None): pass ----- in python: >>> import pyximport; pyximport.install() (None, <pyximport.pyximport.PyxImporter object at 0x10f7c0410>) >>> import foo >>> foo.foo.__kwdefaults__ zsh: segmentation fault This works of course when compiled with a setup.py script as well; the above is just the most minimal test case. There's no segfault without the keyword argument, and no segfault if the fused type is replaced with a regular type. Here's the chunk of the backtrace that's in cython code (from running python3 under lldb): * frame #0: 0x0000000103b801b9 foo.so`__pyx_pf_3foo_12__defaults__(__pyx_self=0x0000000102741458) + 41 at foo.c:1294 1291 __Pyx_XDECREF(__pyx_r); 1292 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 1293 __Pyx_GOTREF(__pyx_t_1); -> 1294 __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_baz); 1295 __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_baz); 1296 PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_baz); 1297 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} frame #1: 0x0000000103b838c0 foo.so`__Pyx_CyFunction_get_kwdefaults [inlined] __Pyx_CyFunction_init_defaults(op=0x0000000102741458) + 5 at foo.c:2789 frame #2: 0x0000000103b838bb foo.so`__Pyx_CyFunction_get_kwdefaults(op=0x0000000102741458) + 43 at foo.c:2859 Best, Zach Zachary Pincus, PhD Assistant Professor of Developmental Biology and Genetics Washington University School of Medicine http://zplab.wustl.edu _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel