1__doc__ = u"""
2>>> import sys
3>>> if not IS_PY3: sys.exc_clear()
4
5>>> def test_py():
6...   try:
7...     raise AttributeError
8...   except AttributeError:
9...     print(sys.exc_info()[0] == AttributeError or sys.exc_info()[0])
10...   print((IS_PY3 and sys.exc_info()[0] is None) or
11...         (not IS_PY3 and sys.exc_info()[0] == AttributeError) or
12...         sys.exc_info()[0])
13
14>>> print(sys.exc_info()[0]) # 0
15None
16>>> test_py()
17True
18True
19
20>>> print(sys.exc_info()[0]) # test_py()
21None
22
23>>> test_c()
24True
25True
26>>> print(sys.exc_info()[0]) # test_c()
27None
28"""
29
30import sys
31
32IS_PY3 = sys.version_info[0] >= 3
33
34def test_c():
35    try:
36        raise AttributeError
37    except AttributeError:
38        print(sys.exc_info()[0] == AttributeError or sys.exc_info()[0])
39    print(sys.exc_info()[0] is None or sys.exc_info()[0])
40