[ create a new paste ] login | about

Link: http://codepad.org/M5CevRwT    [ raw code | output | fork ]

michael.yixuan.wu@gmail.com - Python, pasted on Jun 22:
1
2
3
4
5
6
7
8
9
10
11
12
13
# wrong line!

# this one works as expected
try:
    raise 'one'
except:
    pass

# this one prints the wrong line
exec("raise 'two'")

# this one works as expected
exec("raise Exception('three')")


Output:
1
2
3
4
5
6
7
8
9
t.py:5: DeprecationWarning: raising a string exception is deprecated
  raise 'one'
t.py:1: DeprecationWarning: raising a string exception is deprecated
  # wrong line!
Traceback (most recent call last):
  Line 10, in <module>
    exec("raise 'two'")
  File "<string>", line 1, in <module>
two


Create a new paste based on this one


Comments: