summaryrefslogtreecommitdiff
path: root/tests/compile
diff options
context:
space:
mode:
authorda-woods <dw-git@d-woods.co.uk>2020-12-18 21:47:33 +0000
committerda-woods <dw-git@d-woods.co.uk>2020-12-18 22:00:53 +0000
commit88fff64595872c3bc840afced689e2da4635778e (patch)
treeec05bef03af3c3770582281a9c09f73befb648b6 /tests/compile
parent00001be911cba852f17512fa0056adb2eb88b1e6 (diff)
downloadcython-88fff64595872c3bc840afced689e2da4635778e.tar.gz
Fix missing utility code for complex annotations
Generating utility-code for complex types is special-cased, but it wasn't when they were generated in annotations. Fixes https://github.com/cython/cython/issues/3949
Diffstat (limited to 'tests/compile')
-rw-r--r--tests/compile/complex_annotations.pyx7
-rw-r--r--tests/compile/complex_decorators.pyx10
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/compile/complex_annotations.pyx b/tests/compile/complex_annotations.pyx
new file mode 100644
index 000000000..5d95611ac
--- /dev/null
+++ b/tests/compile/complex_annotations.pyx
@@ -0,0 +1,7 @@
+# mode: compile
+
+# Complex numbers defined in annotations weren't having their utility code imported directly
+# leading to compile-errors that the type wasn't defined. The test is intentionally minimal since
+# anything more thorough ends up creating the utility code
+cdef f(x: complex):
+ pass
diff --git a/tests/compile/complex_decorators.pyx b/tests/compile/complex_decorators.pyx
new file mode 100644
index 000000000..e8d65244d
--- /dev/null
+++ b/tests/compile/complex_decorators.pyx
@@ -0,0 +1,10 @@
+# mode: compile
+
+cimport cython
+
+# Complex numbers defined in "cython.locals" weren't having their utility code imported directly
+# leading to compile-errors that the type wasn't defined. The test is intentionally minimal since
+# anything more thorough ends up creating the utility code
+@cython.locals(x=complex)
+cdef f(x):
+ pass