sgzwiz / brython

Automatically exported from code.google.com/p/brython
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

try...except..raise not working #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello!

Here are some tests that pass in Python 3.3 and differently fail in Brython:

def test1(): #this one works, actually
 print('test1...')
 try:
  raise
  print('Fail')
 except:
  print('OK')

def test2():
 print('test2...')
 try:
  1/0
  print('Fail')
 except:
  print('OK')

def test3():
 print('test3...')
 try:
  raise Exception('test exception')
  print('Fail')
 except:
  print('OK')

def test4():
 print('test4...')
 try:
  raise
  print('Fail')
 except Exception:
  print('OK')

def test5():
 print('test5...')
 try:
  raise Exception('OK')
  print('Fail')
 except Exception as ex:
  print(str(ex))

test1()
test2()
test3() 
test4()
test5()

Original issue reported on code.google.com by bisofter@gmail.com on 28 Dec 2012 at 7:19

GoogleCodeExporter commented 9 years ago
The only real bug is the division by 0 : I fix it in the next release
In the other cases, the error message is that Python keywords 'as' and 'raise' 
are not implemented (yet) in Brython, this is mentioned in the documentation
I leave the issue open until they are implemented
- Pierre

Original comment by pierre.q...@gmail.com on 28 Dec 2012 at 8:42

GoogleCodeExporter commented 9 years ago
Fixed in revision 541

Original comment by pierre.q...@gmail.com on 22 Feb 2013 at 10:06