Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ca1ad182
Commit
ca1ad182
authored
Feb 15, 2000
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tidy up tryexcept and tryfinally nodes
parent
6e83cacb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
28 deletions
+40
-28
Lib/compiler/ast.py
Lib/compiler/ast.py
+20
-14
Tools/compiler/compiler/ast.py
Tools/compiler/compiler/ast.py
+20
-14
No files found.
Lib/compiler/ast.py
View file @
ca1ad182
...
...
@@ -222,28 +222,34 @@ class Raise(Node):
def
__repr__
(
self
):
return
"Raise(%s,%s,%s)"
%
self
.
_children
[
1
:]
class
Try
f
inally
(
Node
):
nodes
[
'tryfinally'
]
=
'Try
f
inally'
class
Try
F
inally
(
Node
):
nodes
[
'tryfinally'
]
=
'Try
F
inally'
def
__init__
(
self
,
try_
,
fin
):
self
.
try_
=
try_
self
.
fin
=
fin
self
.
_children
=
(
'tryfinally'
,
try_
,
fin
)
def
__init__
(
self
,
body
,
final
):
self
.
body
=
body
self
.
fin
al
=
final
self
.
_children
=
(
'tryfinally'
,
body
,
final
)
def
__repr__
(
self
):
return
"Tryfinally(%s,%s)"
%
self
.
_children
[
1
:]
return
"TryFinally(%s,%s)"
%
self
.
_children
[
1
:]
class
TryExcept
(
Node
):
"""Try/Except body and handlers
class
Tryexcept
(
Node
):
nodes
[
'tryexcept'
]
=
'Tryexcept'
The handlers attribute is a sequence of tuples. The elements of the
tuple are the exception name, the name to bind the exception to, and
the body of the except clause.
"""
nodes
[
'tryexcept'
]
=
'TryExcept'
def
__init__
(
self
,
try_
,
exc
s
,
else_
):
self
.
try_
=
try_
self
.
excs
=
exc
s
def
__init__
(
self
,
body
,
handler
s
,
else_
):
self
.
body
=
body
self
.
handlers
=
handler
s
self
.
else_
=
else_
self
.
_children
=
(
'tryexcept'
,
try_
,
exc
s
,
else_
)
self
.
_children
=
(
'tryexcept'
,
body
,
handler
s
,
else_
)
def
__repr__
(
self
):
return
"Try
e
xcept(%s,%s,%s)"
%
self
.
_children
[
1
:]
return
"Try
E
xcept(%s,%s,%s)"
%
self
.
_children
[
1
:]
class
Return
(
Node
):
nodes
[
'return'
]
=
'Return'
...
...
Tools/compiler/compiler/ast.py
View file @
ca1ad182
...
...
@@ -222,28 +222,34 @@ class Raise(Node):
def
__repr__
(
self
):
return
"Raise(%s,%s,%s)"
%
self
.
_children
[
1
:]
class
Try
f
inally
(
Node
):
nodes
[
'tryfinally'
]
=
'Try
f
inally'
class
Try
F
inally
(
Node
):
nodes
[
'tryfinally'
]
=
'Try
F
inally'
def
__init__
(
self
,
try_
,
fin
):
self
.
try_
=
try_
self
.
fin
=
fin
self
.
_children
=
(
'tryfinally'
,
try_
,
fin
)
def
__init__
(
self
,
body
,
final
):
self
.
body
=
body
self
.
fin
al
=
final
self
.
_children
=
(
'tryfinally'
,
body
,
final
)
def
__repr__
(
self
):
return
"Tryfinally(%s,%s)"
%
self
.
_children
[
1
:]
return
"TryFinally(%s,%s)"
%
self
.
_children
[
1
:]
class
TryExcept
(
Node
):
"""Try/Except body and handlers
class
Tryexcept
(
Node
):
nodes
[
'tryexcept'
]
=
'Tryexcept'
The handlers attribute is a sequence of tuples. The elements of the
tuple are the exception name, the name to bind the exception to, and
the body of the except clause.
"""
nodes
[
'tryexcept'
]
=
'TryExcept'
def
__init__
(
self
,
try_
,
exc
s
,
else_
):
self
.
try_
=
try_
self
.
excs
=
exc
s
def
__init__
(
self
,
body
,
handler
s
,
else_
):
self
.
body
=
body
self
.
handlers
=
handler
s
self
.
else_
=
else_
self
.
_children
=
(
'tryexcept'
,
try_
,
exc
s
,
else_
)
self
.
_children
=
(
'tryexcept'
,
body
,
handler
s
,
else_
)
def
__repr__
(
self
):
return
"Try
e
xcept(%s,%s,%s)"
%
self
.
_children
[
1
:]
return
"Try
E
xcept(%s,%s,%s)"
%
self
.
_children
[
1
:]
class
Return
(
Node
):
nodes
[
'return'
]
=
'Return'
...
...
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