Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
e6f92c17
Commit
e6f92c17
authored
Dec 18, 2020
by
Robert Bradshaw
Committed by
GitHub
Dec 18, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3950 from da-woods/complex_annotation_utilcode
Fix missing utility code for complex annotations
parents
a1dd447d
88fff645
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
0 deletions
+23
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+3
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+3
-0
tests/compile/complex_annotations.pyx
tests/compile/complex_annotations.pyx
+7
-0
tests/compile/complex_decorators.pyx
tests/compile/complex_decorators.pyx
+10
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
e6f92c17
...
...
@@ -13857,6 +13857,9 @@ class AnnotationNode(ExprNode):
warning
(
annotation
.
pos
,
"Strings should no longer be used for type declarations. Use 'cython.int' etc. directly."
,
level
=
1
)
elif
arg_type
is
not
None
and
arg_type
.
is_complex
:
# creating utility code needs to be special-cased for complex types
arg_type
.
create_declaration_utility_code
(
env
)
if
arg_type
is
not
None
:
if
explicit_pytype
and
not
explicit_ctype
and
not
arg_type
.
is_pyobject
:
warning
(
annotation
.
pos
,
...
...
Cython/Compiler/Nodes.py
View file @
e6f92c17
...
...
@@ -1783,6 +1783,9 @@ class FuncDefNode(StatNode, BlockNode):
error
(
type_node
.
pos
,
"Previous declaration here"
)
else
:
arg
.
type
=
other_type
if
arg
.
type
.
is_complex
:
# utility code for complex types is special-cased and also important to ensure that it's run
arg
.
type
.
create_declaration_utility_code
(
env
)
return
arg
def
need_gil_acquisition
(
self
,
lenv
):
...
...
tests/compile/complex_annotations.pyx
0 → 100644
View file @
e6f92c17
# 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
tests/compile/complex_decorators.pyx
0 → 100644
View file @
e6f92c17
# 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment