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
025cc6d7
Commit
025cc6d7
authored
Jan 29, 2009
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further kludging for #151
parent
c74fc36e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+12
-10
No files found.
Cython/Compiler/ParseTreeTransforms.py
View file @
025cc6d7
...
@@ -3,7 +3,7 @@ from Cython.Compiler.ModuleNode import ModuleNode
...
@@ -3,7 +3,7 @@ from Cython.Compiler.ModuleNode import ModuleNode
from
Cython.Compiler.Nodes
import
*
from
Cython.Compiler.Nodes
import
*
from
Cython.Compiler.ExprNodes
import
*
from
Cython.Compiler.ExprNodes
import
*
from
Cython.Compiler.UtilNodes
import
*
from
Cython.Compiler.UtilNodes
import
*
from
Cython.Compiler.TreeFragment
import
TreeFragment
from
Cython.Compiler.TreeFragment
import
TreeFragment
,
TemplateTransform
from
Cython.Compiler.StringEncoding
import
EncodedString
from
Cython.Compiler.StringEncoding
import
EncodedString
from
Cython.Compiler.Errors
import
CompileError
from
Cython.Compiler.Errors
import
CompileError
try
:
try
:
...
@@ -545,31 +545,33 @@ class WithTransform(CythonTransform, SkipDeclarations):
...
@@ -545,31 +545,33 @@ class WithTransform(CythonTransform, SkipDeclarations):
pipeline
=
[
NormalizeTree
(
None
)])
pipeline
=
[
NormalizeTree
(
None
)])
def
visit_WithStatNode
(
self
,
node
):
def
visit_WithStatNode
(
self
,
node
):
# TODO: Cleanup badly needed
TemplateTransform
.
temp_name_counter
+=
1
handle
=
"__tmpvar_%d"
%
TemplateTransform
.
temp_name_counter
self
.
visitchildren
(
node
,
[
'body'
])
self
.
visitchildren
(
node
,
[
'body'
])
# FIXME: excinfo_temp should be more local to the except
excinfo_temp
=
NameNode
(
node
.
pos
,
name
=
handle
)
#TempHandle(Builtin.tuple_type)
# clause that uses it, to avoid the presetting to None
excinfo_temp
=
TempHandle
(
Builtin
.
tuple_type
)
if
node
.
target
is
not
None
:
if
node
.
target
is
not
None
:
result
=
self
.
template_with_target
.
substitute
({
result
=
self
.
template_with_target
.
substitute
({
u'EXPR'
:
node
.
manager
,
u'EXPR'
:
node
.
manager
,
u'BODY'
:
node
.
body
,
u'BODY'
:
node
.
body
,
u'TARGET'
:
node
.
target
,
u'TARGET'
:
node
.
target
,
u'EXCINFO'
:
excinfo_temp
.
ref
(
node
.
pos
)
u'EXCINFO'
:
excinfo_temp
},
pos
=
node
.
pos
)
},
pos
=
node
.
pos
)
else
:
else
:
result
=
self
.
template_without_target
.
substitute
({
result
=
self
.
template_without_target
.
substitute
({
u'EXPR'
:
node
.
manager
,
u'EXPR'
:
node
.
manager
,
u'BODY'
:
node
.
body
,
u'BODY'
:
node
.
body
,
u'EXCINFO'
:
excinfo_temp
.
ref
(
node
.
pos
)
u'EXCINFO'
:
excinfo_temp
},
pos
=
node
.
pos
)
},
pos
=
node
.
pos
)
# Set except excinfo target to EXCINFO
# Set except excinfo target to EXCINFO
try_except
=
result
.
stats
[
-
1
].
body
.
stats
[
-
1
]
try_except
=
result
.
stats
[
-
1
].
body
.
stats
[
-
1
]
try_except
.
except_clauses
[
0
].
excinfo_target
=
(
try_except
.
except_clauses
[
0
].
excinfo_target
=
NameNode
(
node
.
pos
,
name
=
handle
)
excinfo_temp
.
ref
(
node
.
pos
))
#
excinfo_temp.ref(node.pos))
result
.
stats
[
-
1
].
body
.
stats
[
-
1
]
=
TempsBlockNode
(
#
result.stats[-1].body.stats[-1] = TempsBlockNode(
node
.
pos
,
temps
=
[
excinfo_temp
],
body
=
try_except
)
#
node.pos, temps=[excinfo_temp], body=try_except)
return
result
return
result
...
...
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