[Pyrex] Reraise not inside except clause

Robert Kern robert.kern at gmail.com
Tue Oct 16 06:56:28 CEST 2007


It is valid in Python to have an empty "raise" statement anywhere, and it used
to be valid in Pyrex before 0.9.6. This new restriction breaks PyProtocol's
_speedups.pyx. Here is a smaller example:


[raiseerr]$ cat raiseerr.pyx
def raise_err():
    if True:
        raise

def exception():
    try:
        raise ValueError('foo')
    except:
        raise_err()

exception()
[raiseerr]$ python raiseerr.pyx
Traceback (most recent call last):
  File "raiseerr.pyx", line 11, in <module>
    exception()
  File "raiseerr.pyx", line 9, in exception
    raise_err()
  File "raiseerr.pyx", line 7, in exception
    raise ValueError('foo')
ValueError: foo
[raiseerr]$ pyrexc raiseerr.pyx
/Users/rkern/hg/raiseerr/raiseerr.pyx:3:8: Reraise not inside except clause


Can this restriction be reverted?

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Pyrex mailing list