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
ce98ed57
Commit
ce98ed57
authored
Apr 13, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent plain annotation type parsing from erroring out on unparsable annotations
parent
c31b0fad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+3
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
ce98ed57
...
...
@@ -1179,11 +1179,13 @@ def _analyse_name_as_type(name, pos, env):
type
=
PyrexTypes
.
parse_basic_type
(
name
)
if
type
is
not
None
:
return
type
hold_errors
()
from
TreeFragment
import
TreeFragment
pos
=
(
pos
[
0
],
pos
[
1
],
pos
[
2
]
-
7
)
declaration
=
TreeFragment
(
u"sizeof(%s)"
%
name
,
name
=
pos
[
0
].
filename
,
initial_pos
=
pos
)
sizeof_node
=
declaration
.
root
.
stats
[
0
].
expr
sizeof_node
=
sizeof_node
.
analyse_types
(
env
)
release_errors
(
ignore
=
True
)
if
isinstance
(
sizeof_node
,
SizeofTypeNode
):
return
sizeof_node
.
arg_type
return
None
...
...
Cython/Compiler/Nodes.py
View file @
ce98ed57
...
...
@@ -839,7 +839,7 @@ class CArgDeclNode(Node):
def
inject_type_from_annotations
(
self
,
env
):
annotation
=
self
.
annotation
if
not
annotation
:
return
return
None
explicit_pytype
=
explicit_ctype
=
False
if
annotation
.
is_dict_literal
:
for
name
,
value
in
annotation
.
key_value_pairs
:
...
...
@@ -1569,6 +1569,8 @@ class FuncDefNode(StatNode, BlockNode):
elif
isinstance
(
arg
,
CArgDeclNode
)
and
arg
.
annotation
:
type_node
=
arg
.
annotation
other_type
=
arg
.
inject_type_from_annotations
(
env
)
if
other_type
is
None
:
return
arg
else
:
return
arg
if
other_type
is
None
:
...
...
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