summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2023-04-24 11:51:07 +0200
committerStefan Behnel <stefan_ml@behnel.de>2023-04-24 18:56:11 +0200
commit0cc6b283d093ccbfd0dd4c350fb1cc9c789f07dc (patch)
tree3e62aec220a0a1dd72afcc188b63c55fcb94a3b8
parent3d68fce3350e209a7d9e3ce338cba53fc2f39f28 (diff)
downloadcython-0cc6b283d093ccbfd0dd4c350fb1cc9c789f07dc.tar.gz
Treat @ufunc directive like @cfunc/@ccall directives by excluding it from the normal directives dict unless it's being used.
-rw-r--r--Cython/Compiler/Options.py2
-rw-r--r--Cython/Compiler/ParseTreeTransforms.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/Cython/Compiler/Options.py b/Cython/Compiler/Options.py
index 1a00bcc54..13d07b495 100644
--- a/Cython/Compiler/Options.py
+++ b/Cython/Compiler/Options.py
@@ -220,7 +220,6 @@ _directive_defaults = {
'np_pythran': False,
'fast_gil': False,
'cpp_locals': False, # uses std::optional for C++ locals, so that they work more like Python locals
- 'ufunc': False,
'legacy_implicit_noexcept': False,
# set __file__ and/or __path__ to known source/target path at import time (instead of not having them available)
@@ -328,6 +327,7 @@ directive_types = {
'binding' : bool,
'cfunc' : None, # decorators do not take directive value
'ccall' : None,
+ 'ufunc': None,
'cpow' : bool,
'inline' : None,
'staticmethod' : None,
diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py
index d90ea4391..6c4275dbd 100644
--- a/Cython/Compiler/ParseTreeTransforms.py
+++ b/Cython/Compiler/ParseTreeTransforms.py
@@ -2399,7 +2399,7 @@ if VALUE is not None:
self.seen_vars_stack.pop()
- if lenv.directives.get("ufunc"):
+ if "ufunc" in lenv.directives:
from . import UFuncs
return UFuncs.convert_to_ufunc(node)
return node