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
Gwenaël Samain
cython
Commits
47deba00
Commit
47deba00
authored
Dec 06, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for-in loop variable inference after enabling list/tuple item type inference
parent
8352b902
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+5
-3
Cython/Compiler/TypeInference.py
Cython/Compiler/TypeInference.py
+3
-2
tests/run/listcomp.pyx
tests/run/listcomp.pyx
+7
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
47deba00
...
...
@@ -2489,9 +2489,11 @@ class NextNode(AtomicExprNode):
return
item_type
else
:
# Avoid duplication of complicated logic.
fake_index_node
=
IndexNode
(
self
.
pos
,
fake_index_node
=
IndexNode
(
self
.
pos
,
base
=
self
.
iterator
.
sequence
,
index
=
IntNode
(
self
.
pos
,
value
=
'0'
))
index
=
IntNode
(
self
.
pos
,
value
=
'PY_SSIZE_T_MAX'
,
type
=
PyrexTypes
.
c_py_ssize_t_type
))
return
fake_index_node
.
infer_type
(
env
)
def
analyse_types
(
self
,
env
):
...
...
Cython/Compiler/TypeInference.py
View file @
47deba00
...
...
@@ -136,8 +136,9 @@ class MarkParallelAssignments(EnvTransform):
# object type when the base type cannot be handled.
self
.
mark_assignment
(
target
,
ExprNodes
.
IndexNode
(
node
.
pos
,
base
=
sequence
,
index
=
ExprNodes
.
IntNode
(
node
.
pos
,
value
=
'0'
)))
base
=
sequence
,
index
=
ExprNodes
.
IntNode
(
target
.
pos
,
value
=
'PY_SSIZE_T_MAX'
,
type
=
PyrexTypes
.
c_py_ssize_t_type
)))
self
.
visitchildren
(
node
)
return
node
...
...
tests/run/listcomp.pyx
View file @
47deba00
...
...
@@ -46,6 +46,13 @@ def inferred_type():
"""
print
[
cython
.
typeof
(
obj
)
for
obj
in
[
A
(),
A
(),
A
()]]
def
not_inferred_type
():
"""
>>> not_inferred_type()
['Python object', 'Python object', 'Python object']
"""
print
[
cython
.
typeof
(
obj
)
for
obj
in
[
1
,
A
(),
'abc'
]]
def
iterdict
():
"""
>>> iterdict()
...
...
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