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
8246c868
Commit
8246c868
authored
Dec 10, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor fixes to the with statement transform
parent
6a08a780
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+9
-4
No files found.
Cython/Compiler/ParseTreeTransforms.py
View file @
8246c868
...
...
@@ -497,9 +497,9 @@ class WithTransform(CythonTransform, SkipDeclarations):
EXIT = MGR.__exit__
MGR.__enter__()
EXC = True
EXCINFO = None
try:
try:
EXCINFO = None
BODY
except:
EXC = False
...
...
@@ -516,9 +516,9 @@ class WithTransform(CythonTransform, SkipDeclarations):
EXIT = MGR.__exit__
VALUE = MGR.__enter__()
EXC = True
EXCINFO = None
try:
try:
EXCINFO = None
TARGET = VALUE
BODY
except:
...
...
@@ -532,6 +532,7 @@ class WithTransform(CythonTransform, SkipDeclarations):
pipeline
=
[
NormalizeTree
(
None
)])
def
visit_WithStatNode
(
self
,
node
):
self
.
visitchildren
(
node
,
[
'body'
])
# FIXME: excinfo_temp should be more local to the except
# clause that uses it, to avoid the presetting to None
excinfo_temp
=
TempHandle
(
Builtin
.
tuple_type
)
...
...
@@ -550,10 +551,14 @@ class WithTransform(CythonTransform, SkipDeclarations):
},
pos
=
node
.
pos
)
# Set except excinfo target to EXCINFO
result
.
body
.
stats
[
5
].
body
.
stats
[
0
].
except_clauses
[
0
].
excinfo_target
=
(
try_except
=
result
.
body
.
stats
[
-
1
].
body
.
stats
[
-
1
]
try_except
.
except_clauses
[
0
].
excinfo_target
=
(
excinfo_temp
.
ref
(
node
.
pos
))
return
TempsBlockNode
(
node
.
pos
,
temps
=
[
excinfo_temp
],
body
=
result
)
result
.
body
.
stats
[
-
1
].
body
.
stats
[
-
1
]
=
TempsBlockNode
(
node
.
pos
,
temps
=
[
excinfo_temp
],
body
=
try_except
)
return
result
def
visit_ExprNode
(
self
,
node
):
# With statements are never inside expressions.
...
...
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