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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
6f7bc67e
Commit
6f7bc67e
authored
Jan 28, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor cleanups
parent
7ae9d5b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+8
-7
No files found.
Cython/Compiler/Nodes.py
View file @
6f7bc67e
...
...
@@ -4046,7 +4046,8 @@ class GeneratorBodyDefNode(DefNode):
lenv
.
scope_class
.
type
.
declaration_code
(
Naming
.
cur_scope_cname
),
lenv
.
scope_class
.
type
.
cast_code
(
'%s->closure'
%
Naming
.
generator_cname
)))
# Normal generator termination no traceback info is required
# on normal generator termination, we do not take the exception propagation
# path: no traceback info is required and not creating it is much faster
code
.
putln
(
'PyErr_SetNone(PyExc_StopIteration);'
)
# ----- Error cleanup
if
code
.
error_label
in
code
.
labels_used
:
...
...
@@ -4061,14 +4062,14 @@ class GeneratorBodyDefNode(DefNode):
code
.
put_xdecref
(
Naming
.
retval_cname
,
py_object_type
)
code
.
putln
(
'%s->resume_label = -1;'
%
Naming
.
generator_cname
)
code
.
put_finish_refcount_context
()
code
.
putln
(
'return NULL;'
)
;
code
.
putln
(
'return NULL;'
)
code
.
putln
(
"}"
)
# ----- Go back and insert temp variable declarations
tempvardecl_code
.
put_temp_declarations
(
code
.
funcstate
)
# ----- Generator resume code
resume_code
.
putln
(
"switch (%s->resume_label) {"
%
(
Naming
.
generator_cname
))
;
Naming
.
generator_cname
))
resume_code
.
putln
(
"case 0: goto %s;"
%
first_run_label
)
from
ParseTreeTransforms
import
YieldNodeCollector
...
...
@@ -4076,11 +4077,11 @@ class GeneratorBodyDefNode(DefNode):
collector
.
visitchildren
(
self
)
for
yield_expr
in
collector
.
yields
:
resume_code
.
putln
(
"case %d: goto %s;"
%
(
yield_expr
.
label_num
,
yield_expr
.
label_name
))
;
resume_code
.
putln
(
"default: /* CPython raises the right error here */"
)
;
yield_expr
.
label_num
,
yield_expr
.
label_name
))
resume_code
.
putln
(
"default: /* CPython raises the right error here */"
)
resume_code
.
put_finish_refcount_context
()
resume_code
.
putln
(
"return NULL;"
)
;
resume_code
.
putln
(
"}"
)
;
resume_code
.
putln
(
"return NULL;"
)
resume_code
.
putln
(
"}"
)
code
.
exit_cfunc_scope
()
...
...
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