2011/8/12 Vitja Makarov <vitja.maka...@gmail.com>: > 2011/8/12 Stefan Behnel <stefan...@behnel.de>: >> [fixed subject] >> >> Romain Guillebert, 12.08.2011 03:19: >>> >>> I tried to compiled Demos/primes.pyx using the ctypes backend and I >>> think I've found a bug : >>> The Entry for the kmax parameter does not set is_arg to 1. However if I >>> turn the def into a cdef, it works fine. >>> >>> Is this a bug or a known hack ? >> >> Vitja already brought this up, too: >> >> http://article.gmane.org/gmane.comp.python.cython.devel/12385 >> >> A quick grep on the sources gives me this: >> >> """ >> Cython/Compiler/Buffer.py: if entry.is_arg: >> Cython/Compiler/Buffer.py: if entry.is_arg: >> Cython/Compiler/ExprNodes.py: return entry and (entry.is_local or >> entry.is_arg) and not entry.in_closure >> Cython/Compiler/FlowControl.py: return (entry.is_local or >> entry.is_pyclass_attr or entry.is_arg or >> Cython/Compiler/FlowControl.py: self.is_arg = False >> Cython/Compiler/FlowControl.py: self.is_arg = True >> Cython/Compiler/FlowControl.py: if assmt.is_arg: >> Cython/Compiler/FlowControl.py: # TODO: starred args entries are >> not marked with is_arg flag >> Cython/Compiler/FlowControl.py: if assmt.is_arg: >> Cython/Compiler/FlowControl.py: is_arg = True >> Cython/Compiler/FlowControl.py: is_arg = False >> Cython/Compiler/FlowControl.py: if is_arg: >> Cython/Compiler/Symtab.py: # is_arg boolean Is the arg of a >> method >> Cython/Compiler/Symtab.py: is_arg = 0 >> Cython/Compiler/Symtab.py: entry.is_arg = 1 >> """ >> >> This doesn't look like it would be wrong (or even just unsafe) to consider >> the unset flag a bug and fix it. Basically, it's almost unused in the >> original sources, all places where the flag is being read currently are >> somewhat recent code that looks reasonable to me and that appear to assume >> that the flag is actually set. >> >> So, I'd say, if anyone wants to properly clean this up, please go ahead and >> do so, but please do it right on the master branch and send it through >> Jenkins. >> > > Yeah, that would be really nice if all args including starred ones > will have is_arg attribute set. >
I've fixed the issue https://github.com/vitek/cython/commits/_is_arg It passes all tests if everything is ok I'll push that to upstream -- vitja. _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel