Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
my2to3
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Emmy Vouriot
my2to3
Commits
cfa7e896
Commit
cfa7e896
authored
Jul 16, 2020
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nested_except_trace: document about another problem
parent
c0302a44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
my2to3/fixes/fix_nested_except_trace.py
my2to3/fixes/fix_nested_except_trace.py
+12
-1
No files found.
my2to3/fixes/fix_nested_except_trace.py
View file @
cfa7e896
...
@@ -11,7 +11,7 @@ class FixNestedExceptTrace(BaseFix):
...
@@ -11,7 +11,7 @@ class FixNestedExceptTrace(BaseFix):
"""This fixer detects scope bugs which can occur due to nested except clauses
"""This fixer detects scope bugs which can occur due to nested except clauses
which use the same variable name.
which use the same variable name.
Try the following
code
yourself in Python 2 and Python 3...
Try the following
two snippets
yourself in Python 2 and Python 3...
try:
try:
raise Exception("foo")
raise Exception("foo")
...
@@ -21,6 +21,17 @@ class FixNestedExceptTrace(BaseFix):
...
@@ -21,6 +21,17 @@ class FixNestedExceptTrace(BaseFix):
except Exception as e:
except Exception as e:
print(e)
print(e)
print(e)
print(e)
---
try:
raise Exception("foo")
except Exception as e:
try:
raise Exception("bar")
except Exception as e:
print(e)
raise
"""
"""
# https://github.com/python/cpython/blob/3549ca313a6103a3adb281ef3a849298b7d7f72c/Lib/lib2to3/fixes/fix_except.py#L39-L45
# https://github.com/python/cpython/blob/3549ca313a6103a3adb281ef3a849298b7d7f72c/Lib/lib2to3/fixes/fix_except.py#L39-L45
PATTERN
=
"""
PATTERN
=
"""
...
...
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