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 ncoghlan
Recipients aronacher, catalin.iacob, draghuram, eric.araujo, ethan.furman, ezio.melotti, mrabarnett, ncoghlan, pitrou, poke, rhettinger, steven.daprano
Date 2012-01-27.01:55:01
SpamBayes Score 1.31989e-11
Marked as misclassified No
Message-id <1327629303.27.0.324384792427.issue6210@psf.upfronthosting.co.za>
In-reply-to
Content
1. Any syntax change requires a PEP (and, IMO, any such PEP for this issue should get rejected: I don't consider this an important enough feature to deserve dedicated syntax. Others disagree, which is one of the reasons why a PEP is needed. The other, more important, reason is to ensure the new syntax is spec'ed out clearly and incorporated into the language reference for the benefit of other implementations in the event that it *does* get approved)

2. A change that *doesn't* need a PEP is to just adjust the implicit exception chaining such that __context__ doesn't get set automatically if it has already been set explicitly (it turns out handling this situation was an open question in PEP 3134, not a specificied behaviour). That way, this task can be handled using a utility function:

    def no_context(new_exc):
        new_exc.__context__ = None
        return new_exc

    def doXY ():
        # ...
        try:
            page = urlopen( someRequest )
        except urllib.error.URLError as e:
            raise no_context(MyError( 'while doing XY', e ))
        # ...
History
Date User Action Args
2012-01-27 01:55:03ncoghlansetrecipients: + ncoghlan, rhettinger, pitrou, draghuram, aronacher, ezio.melotti, eric.araujo, mrabarnett, steven.daprano, poke, ethan.furman, catalin.iacob
2012-01-27 01:55:03ncoghlansetmessageid: <1327629303.27.0.324384792427.issue6210@psf.upfronthosting.co.za>
2012-01-27 01:55:02ncoghlanlinkissue6210 messages
2012-01-27 01:55:01ncoghlancreate