[RFE] Add dummy compiler directive decorators for pure python mode
Hi all, pure python mode will benefit from the addition of dummy decorators for compiler directives to Shadow.py, like in: @cython.boundscheck(False) def f(): pass AFAICS this is not currently valid inside the interpreter. Cheers -- Carlos
Carlos Pita schrieb am 07.04.2015 um 18:39:
pure python mode will benefit from the addition of dummy decorators for compiler directives to Shadow.py, like in:
@cython.boundscheck(False) def f(): pass
AFAICS this is not currently valid inside the interpreter.
Sure, why not. https://github.com/cython/cython/commit/690881089fc2bc16e44e6e88b6a4c979cd57... Stefan
Not sure, but would it be desirable for the decorators to be less dummy and for RuntimeCompiledFunction to take the flags into account when compiling on the fly? Thank you for your prompt support. Cheers -- Carlos
Carlos Pita schrieb am 10.04.2015 um 14:40:
Not sure, but would it be desirable for the decorators to be less dummy and for RuntimeCompiledFunction to take the flags into account when compiling on the fly?
Can you provide a pull request, including tests? Stefan
Not sure, but would it be desirable for the decorators to be less dummy and for RuntimeCompiledFunction to take the flags into account when compiling on the fly?
Can you provide a pull request, including tests?
I don't have much time these days but I gave some thoughts to this and I would like to hear your opinion about the following proposal before start coding: 1. The compiler-directives, locals, etc. decorators will be less dummy in two ways: - They will know how to print a repr of themselves. - They will register themselves under some "private" attribute (say _cython_decorators, do you have any preference here?) of the decorated function. 2. Besides get_body(f), RuntimeCompiledFunction will use a new function get_cython_decorators(f), which returns the concatenated repr of the registered decorators. 3. This block of code will be passed as a new argument (say cython_decorators) to cython_inline. The module code template will now be: module_code = """ %(module_body)s %(cimports)s %(cython_decorators)s def __invoke(%(params)s): %(func_body)s """ What do you think? Cheers -- Carlos
On Sat, Jul 25, 2015 at 6:23 AM, Carlos Pita <carlosjosepita@gmail.com> wrote:
Not sure, but would it be desirable for the decorators to be less dummy and for RuntimeCompiledFunction to take the flags into account when compiling on the fly?
Can you provide a pull request, including tests?
I don't have much time these days but I gave some thoughts to this and I would like to hear your opinion about the following proposal before start coding:
1. The compiler-directives, locals, etc. decorators will be less dummy in two ways: - They will know how to print a repr of themselves. - They will register themselves under some "private" attribute (say _cython_decorators, do you have any preference here?) of the decorated function.
2. Besides get_body(f), RuntimeCompiledFunction will use a new function get_cython_decorators(f), which returns the concatenated repr of the registered decorators.
3. This block of code will be passed as a new argument (say cython_decorators) to cython_inline. The module code template will now be:
module_code = """ %(module_body)s %(cimports)s %(cython_decorators)s def __invoke(%(params)s): %(func_body)s """
What do you think?
+1
participants (3)
-
Carlos Pita -
Robert Bradshaw -
Stefan Behnel