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
16d9b135
Commit
16d9b135
authored
Sep 04, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use more descriptive C label names for yield/yield-from/await
parent
eda7bca9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+3
-3
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-1
No files found.
Cython/Compiler/Code.py
View file @
16d9b135
...
@@ -632,8 +632,8 @@ class FunctionState(object):
...
@@ -632,8 +632,8 @@ class FunctionState(object):
label += '
_
' + name
label += '
_
' + name
return label
return label
def new_yield_label(self):
def new_yield_label(self
, expr_type='
yield
'
):
label = self.new_label('
resume_from_
yield
'
)
label = self.new_label('
resume_from_
%
s
' % expr_type
)
num_and_label = (len(self.yield_labels) + 1, label)
num_and_label = (len(self.yield_labels) + 1, label)
self.yield_labels.append(num_and_label)
self.yield_labels.append(num_and_label)
return num_and_label
return num_and_label
...
@@ -1628,7 +1628,7 @@ class CCodeWriter(object):
...
@@ -1628,7 +1628,7 @@ class CCodeWriter(object):
# Functions delegated to function scope
# Functions delegated to function scope
def
new_label
(
self
,
name
=
None
):
return
self
.
funcstate
.
new_label
(
name
)
def
new_label
(
self
,
name
=
None
):
return
self
.
funcstate
.
new_label
(
name
)
def
new_error_label
(
self
):
return
self
.
funcstate
.
new_error_label
()
def
new_error_label
(
self
):
return
self
.
funcstate
.
new_error_label
()
def
new_yield_label
(
self
):
return
self
.
funcstate
.
new_yield_label
(
)
def
new_yield_label
(
self
,
*
args
):
return
self
.
funcstate
.
new_yield_label
(
*
args
)
def
get_loop_labels
(
self
):
return
self
.
funcstate
.
get_loop_labels
()
def
get_loop_labels
(
self
):
return
self
.
funcstate
.
get_loop_labels
()
def
set_loop_labels
(
self
,
labels
):
return
self
.
funcstate
.
set_loop_labels
(
labels
)
def
set_loop_labels
(
self
,
labels
):
return
self
.
funcstate
.
set_loop_labels
(
labels
)
def
new_loop_labels
(
self
):
return
self
.
funcstate
.
new_loop_labels
()
def
new_loop_labels
(
self
):
return
self
.
funcstate
.
new_loop_labels
()
...
...
Cython/Compiler/ExprNodes.py
View file @
16d9b135
...
@@ -9445,7 +9445,8 @@ class YieldExprNode(ExprNode):
...
@@ -9445,7 +9445,8 @@ class YieldExprNode(ExprNode):
Generate the code to return the argument in 'Naming.retval_cname'
Generate the code to return the argument in 'Naming.retval_cname'
and to continue at the yield label.
and to continue at the yield label.
"""
"""
label_num
,
label_name
=
code
.
new_yield_label
()
label_num
,
label_name
=
code
.
new_yield_label
(
self
.
expr_keyword
.
replace
(
' '
,
'_'
))
code
.
use_label
(
label_name
)
code
.
use_label
(
label_name
)
saved
=
[]
saved
=
[]
...
...
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