forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
34 lines (26 loc) · 805 Bytes
/
test.py
File metadata and controls
34 lines (26 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from __future__ import print_function
import traceback
import sys
class MyException(Exception):
pass
def raise_secret_exception():
raise MyException("Message", "secret info")
def foo():
try:
raise_secret_exception()
except Exception as e:
s = traceback.format_exc()
print(s)
etype, evalue, tb = sys.exc_info()
t = traceback.extract_tb(tb)
u = traceback.extract_stack()
v = traceback.format_list(t)
w = traceback.format_exception_only(etype, evalue)
x = traceback.format_exception(etype, evalue, tb)
y = traceback.format_tb(tb)
z = traceback.format_stack()
message, args = e.message, e.args
print(tb, t, u, v, w, x, y, z, message, args)
foo()
#For test to find stdlib
import os