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
f15d1596
Commit
f15d1596
authored
Sep 29, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use sys.exc_info() where needed.
parent
c90ad210
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
38 additions
and
32 deletions
+38
-32
Lib/bdb.py
Lib/bdb.py
+2
-2
Lib/cgi.py
Lib/cgi.py
+2
-1
Lib/lib-old/tb.py
Lib/lib-old/tb.py
+6
-5
Lib/mhlib.py
Lib/mhlib.py
+1
-1
Lib/ni.py
Lib/ni.py
+1
-2
Lib/ni1.py
Lib/ni1.py
+1
-2
Lib/pdb.py
Lib/pdb.py
+15
-12
Lib/tb.py
Lib/tb.py
+6
-5
Lib/types.py
Lib/types.py
+4
-2
No files found.
Lib/bdb.py
View file @
f15d1596
...
@@ -148,7 +148,7 @@ class Bdb: # Basic Debugger
...
@@ -148,7 +148,7 @@ class Bdb: # Basic Debugger
try
:
try
:
1
+
''
1
+
''
except
:
except
:
frame
=
sys
.
exc_
traceback
.
tb_frame
.
f_back
frame
=
sys
.
exc_
info
()[
2
]
.
tb_frame
.
f_back
self
.
reset
()
self
.
reset
()
while
frame
:
while
frame
:
frame
.
f_trace
=
self
.
trace_dispatch
frame
.
f_trace
=
self
.
trace_dispatch
...
@@ -168,7 +168,7 @@ class Bdb: # Basic Debugger
...
@@ -168,7 +168,7 @@ class Bdb: # Basic Debugger
try
:
try
:
1
+
''
# raise an exception
1
+
''
# raise an exception
except
:
except
:
frame
=
sys
.
exc_
traceback
.
tb_frame
.
f_back
frame
=
sys
.
exc_
info
()[
2
]
.
tb_frame
.
f_back
while
frame
and
frame
is
not
self
.
botframe
:
while
frame
and
frame
is
not
self
.
botframe
:
del
frame
.
f_trace
del
frame
.
f_trace
frame
=
frame
.
f_back
frame
=
frame
.
f_back
...
...
Lib/cgi.py
View file @
f15d1596
...
@@ -1210,7 +1210,7 @@ def test(environ=os.environ):
...
@@ -1210,7 +1210,7 @@ def test(environ=os.environ):
def
print_exception
(
type
=
None
,
value
=
None
,
tb
=
None
,
limit
=
None
):
def
print_exception
(
type
=
None
,
value
=
None
,
tb
=
None
,
limit
=
None
):
if
type
is
None
:
if
type
is
None
:
type
,
value
,
tb
=
sys
.
exc_
type
,
sys
.
exc_value
,
sys
.
exc_traceback
type
,
value
,
tb
=
sys
.
exc_
info
()
import
traceback
import
traceback
print
print
print
"<H3>Traceback (innermost last):</H3>"
print
"<H3>Traceback (innermost last):</H3>"
...
@@ -1220,6 +1220,7 @@ def print_exception(type=None, value=None, tb=None, limit=None):
...
@@ -1220,6 +1220,7 @@ def print_exception(type=None, value=None, tb=None, limit=None):
escape
(
string
.
join
(
list
[:
-
1
],
""
)),
escape
(
string
.
join
(
list
[:
-
1
],
""
)),
escape
(
list
[
-
1
]),
escape
(
list
[
-
1
]),
)
)
del
tb
def
print_environ
(
environ
=
os
.
environ
):
def
print_environ
(
environ
=
os
.
environ
):
"""Dump the shell environment as HTML."""
"""Dump the shell environment as HTML."""
...
...
Lib/lib-old/tb.py
View file @
f15d1596
...
@@ -74,13 +74,14 @@ def browserexec(tb, cmd):
...
@@ -74,13 +74,14 @@ def browserexec(tb, cmd):
try
:
try
:
exec
cmd
+
'
\
n
'
in
globals
,
locals
exec
cmd
+
'
\
n
'
in
globals
,
locals
except
:
except
:
t
,
v
=
sys
.
exc_info
()[:
2
]
print
'*** Exception:'
,
print
'*** Exception:'
,
if
type
(
sys
.
exc_type
)
==
type
(
''
):
if
type
(
t
)
==
type
(
''
):
print
sys
.
exc_type
,
print
t
,
else
:
else
:
print
sys
.
exc_type
.
__name__
,
print
t
.
__name__
,
if
sys
.
exc_value
<>
None
:
if
v
<>
None
:
print
':'
,
sys
.
exc_value
,
print
':'
,
v
,
print
print
print
'Type help to get help.'
print
'Type help to get help.'
...
...
Lib/mhlib.py
View file @
f15d1596
...
@@ -379,7 +379,7 @@ class Folder:
...
@@ -379,7 +379,7 @@ class Folder:
if
not
seqs
.
has_key
(
head
):
if
not
seqs
.
has_key
(
head
):
if
not
msg
:
if
not
msg
:
msg
=
"bad message list %s"
%
seq
msg
=
"bad message list %s"
%
seq
raise
Error
,
msg
,
sys
.
exc_
traceback
raise
Error
,
msg
,
sys
.
exc_
info
()[
2
]
msgs
=
seqs
[
head
]
msgs
=
seqs
[
head
]
if
not
msgs
:
if
not
msgs
:
raise
Error
,
"sequence %s empty"
%
head
raise
Error
,
"sequence %s empty"
%
head
...
...
Lib/ni.py
View file @
f15d1596
...
@@ -412,8 +412,7 @@ def test():
...
@@ -412,8 +412,7 @@ def test():
try
:
try
:
testproper
()
testproper
()
except
:
except
:
sys
.
last_type
,
sys
.
last_value
,
sys
.
last_traceback
=
(
sys
.
last_type
,
sys
.
last_value
,
sys
.
last_traceback
=
sys
.
exc_info
()
sys
.
exc_type
,
sys
.
exc_value
,
sys
.
exc_traceback
)
print
print
print
sys
.
last_type
,
':'
,
sys
.
last_value
print
sys
.
last_type
,
':'
,
sys
.
last_value
print
print
...
...
Lib/ni1.py
View file @
f15d1596
...
@@ -412,8 +412,7 @@ def test():
...
@@ -412,8 +412,7 @@ def test():
try
:
try
:
testproper
()
testproper
()
except
:
except
:
sys
.
last_type
,
sys
.
last_value
,
sys
.
last_traceback
=
(
sys
.
last_type
,
sys
.
last_value
,
sys
.
last_traceback
=
sys
.
exc_info
()
sys
.
exc_type
,
sys
.
exc_value
,
sys
.
exc_traceback
)
print
print
print
sys
.
last_type
,
':'
,
sys
.
last_value
print
sys
.
last_type
,
':'
,
sys
.
last_value
print
print
...
...
Lib/pdb.py
View file @
f15d1596
...
@@ -80,10 +80,11 @@ class Pdb(bdb.Bdb, cmd.Cmd):
...
@@ -80,10 +80,11 @@ class Pdb(bdb.Bdb, cmd.Cmd):
code
=
compile
(
line
+
'
\
n
'
,
'<stdin>'
,
'single'
)
code
=
compile
(
line
+
'
\
n
'
,
'<stdin>'
,
'single'
)
exec
code
in
globals
,
locals
exec
code
in
globals
,
locals
except
:
except
:
if
type
(
sys
.
exc_type
)
==
type
(
''
):
t
,
v
=
sys
.
exc_info
()[:
2
]
exc_type_name
=
sys
.
exc_type
if
type
(
t
)
==
type
(
''
):
else
:
exc_type_name
=
sys
.
exc_type
.
__name__
exc_type_name
=
t
print
'***'
,
exc_type_name
+
':'
,
sys
.
exc_value
else
:
exc_type_name
=
t
.
__name__
print
'***'
,
exc_type_name
+
':'
,
v
# Command definitions, called by cmdloop()
# Command definitions, called by cmdloop()
# The argument is the remaining string on the command line
# The argument is the remaining string on the command line
...
@@ -219,10 +220,11 @@ class Pdb(bdb.Bdb, cmd.Cmd):
...
@@ -219,10 +220,11 @@ class Pdb(bdb.Bdb, cmd.Cmd):
value
=
eval
(
arg
,
self
.
curframe
.
f_globals
,
\
value
=
eval
(
arg
,
self
.
curframe
.
f_globals
,
\
self
.
curframe
.
f_locals
)
self
.
curframe
.
f_locals
)
except
:
except
:
if
type
(
sys
.
exc_type
)
==
type
(
''
):
t
,
v
=
sys
.
exc_info
()[:
2
]
exc_type_name
=
sys
.
exc_type
if
type
(
t
)
==
type
(
''
):
else
:
exc_type_name
=
sys
.
exc_type
.
__name__
exc_type_name
=
t
print
'***'
,
exc_type_name
+
':'
,
`sys.exc_value`
else
:
exc_type_name
=
t
.
__name__
print
'***'
,
exc_type_name
+
':'
,
`v`
return
return
print
`value`
print
`value`
...
@@ -277,10 +279,11 @@ class Pdb(bdb.Bdb, cmd.Cmd):
...
@@ -277,10 +279,11 @@ class Pdb(bdb.Bdb, cmd.Cmd):
value
=
eval
(
arg
,
self
.
curframe
.
f_globals
,
\
value
=
eval
(
arg
,
self
.
curframe
.
f_globals
,
\
self
.
curframe
.
f_locals
)
self
.
curframe
.
f_locals
)
except
:
except
:
if
type
(
sys
.
exc_type
)
==
type
(
''
):
t
,
v
=
sys
.
exc_info
()[:
2
]
exc_type_name
=
sys
.
exc_type
if
type
(
t
)
==
type
(
''
):
else
:
exc_type_name
=
sys
.
exc_type
.
__name__
exc_type_name
=
t
print
'***'
,
exc_type_name
+
':'
,
`sys.exc_value`
else
:
exc_type_name
=
t
.
__name__
print
'***'
,
exc_type_name
+
':'
,
`v`
return
return
code
=
None
code
=
None
# Is it a function?
# Is it a function?
...
...
Lib/tb.py
View file @
f15d1596
...
@@ -74,13 +74,14 @@ def browserexec(tb, cmd):
...
@@ -74,13 +74,14 @@ def browserexec(tb, cmd):
try
:
try
:
exec
cmd
+
'
\
n
'
in
globals
,
locals
exec
cmd
+
'
\
n
'
in
globals
,
locals
except
:
except
:
t
,
v
=
sys
.
exc_info
()[:
2
]
print
'*** Exception:'
,
print
'*** Exception:'
,
if
type
(
sys
.
exc_type
)
==
type
(
''
):
if
type
(
t
)
==
type
(
''
):
print
sys
.
exc_type
,
print
t
,
else
:
else
:
print
sys
.
exc_type
.
__name__
,
print
t
.
__name__
,
if
sys
.
exc_value
<>
None
:
if
v
<>
None
:
print
':'
,
sys
.
exc_value
,
print
':'
,
v
,
print
print
print
'Type help to get help.'
print
'Type help to get help.'
...
...
Lib/types.py
View file @
f15d1596
...
@@ -51,10 +51,12 @@ try:
...
@@ -51,10 +51,12 @@ try:
raise
TypeError
raise
TypeError
except
TypeError
:
except
TypeError
:
try
:
try
:
TracebackType
=
type
(
sys
.
exc_traceback
)
tb
=
sys
.
exc_info
()[
2
]
FrameType
=
type
(
sys
.
exc_traceback
.
tb_frame
)
TracebackType
=
type
(
tb
)
FrameType
=
type
(
tb
.
tb_frame
)
except
:
except
:
pass
pass
tb
=
None
;
del
tb
SliceType
=
type
(
slice
(
0
))
SliceType
=
type
(
slice
(
0
))
EllipsisType
=
type
(
Ellipsis
)
EllipsisType
=
type
(
Ellipsis
)
...
...
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