From 88fff64595872c3bc840afced689e2da4635778e Mon Sep 17 00:00:00 2001 From: da-woods Date: Fri, 18 Dec 2020 21:47:33 +0000 Subject: 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 --- tests/compile/complex_annotations.pyx | 7 +++++++ tests/compile/complex_decorators.pyx | 10 ++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/compile/complex_annotations.pyx create mode 100644 tests/compile/complex_decorators.pyx (limited to 'tests/compile') 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 -- cgit v1.2.1