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 mwilliamson
Recipients docs@python, jayanthkoushik, mwilliamson, terry.reedy
Date 2014-08-22.21:10:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1408741844.89.0.409626683629.issue22243@psf.upfronthosting.co.za>
In-reply-to
Content
> Using 'expression' (or 'expr' in the ast doc) for what should be 'exceptions: identifier' or paranthesized tuple of identifiers;, is also too broad. However, that must be enforced in the compiler rather than the parser, and compiler restrictions are in the text, not the grammar.

I would expect any expression to be valid so long as it evaluates at runtime to an exception type (or tuple of exception types), so the use of expression seems correct to me. In other words, the following is valid Python (but would not be allowed if I've understood your statement correctly):

    def f():
        try:
            "".blah
        except some_error():
            print("caught")
            
    def some_error():
        return AttributeError

    f()
History
Date User Action Args
2014-08-22 21:10:44mwilliamsonsetrecipients: + mwilliamson, terry.reedy, docs@python, jayanthkoushik
2014-08-22 21:10:44mwilliamsonsetmessageid: <1408741844.89.0.409626683629.issue22243@psf.upfronthosting.co.za>
2014-08-22 21:10:44mwilliamsonlinkissue22243 messages
2014-08-22 21:10:44mwilliamsoncreate