This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Tyler.Crompton
Recipients Tyler.Crompton
Date 2012-06-27.18:27:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1340821665.84.0.121596566188.issue15209@psf.upfronthosting.co.za>
In-reply-to
Content
As you know, a caught exception can be re-raised with a simple `raise` statement. Plain and simple. However, one cannot re-raise an error with this new `"from" expression` clause.

For example:

    def getch(prompt=''):
        '''Get and return a character (similar to `input()`).'''

        print(prompt, end='')
        try:
            return windows_module.getch()
        except NameError:
            try:
                fallback_module.getch()
            except Exception:
                raise from None

Output:

      File "getch.py", line 11
        raise from None
                 ^
    SyntaxError: invalid syntax

A quick look at the documentation about [raise](http://docs.python.org/dev/reference/simple_stmts.html#the-raise-statement) confirms that this is the intended behavior. In my opinion, one should be able to still re-raise from an expression.
History
Date User Action Args
2012-06-27 18:27:46Tyler.Cromptonsetrecipients: + Tyler.Crompton
2012-06-27 18:27:45Tyler.Cromptonsetmessageid: <1340821665.84.0.121596566188.issue15209@psf.upfronthosting.co.za>
2012-06-27 18:27:44Tyler.Cromptonlinkissue15209 messages
2012-06-27 18:27:43Tyler.Cromptoncreate