On 3/2/07, Collin Winter <[EMAIL PROTECTED]> wrote: > On 3/1/07, Brett Cannon <[EMAIL PROTECTED]> wrote: > > I spent my sprint time cleaning up exceptions for Py3K and Guido > > suggested I run some things by the group to make sure they don't make > > transitioning from 2.6 too difficult. After adding the proper > > restrictions in terms of what can and cannot be raised or caught, I > > began cleaning up BaseException's API per PEP 352. > > > > First thing I did was remove slicing. That wasn't too bad since I > > just got exceptions about the lack of __getitem__ and went to the > > affected line and tossed in '.args' between the index and the > > exception. Not sure if 2to3 can handle this as it would need to > > realize when an exception is within scope and then insert '.args' when > > it is be indexed on. > > 2to3 currently cannot handle this. 2.6's "py3k-compat" mode could > handle it easily, though. >
Yep. I exchanged some emails with Guido privately and this was the conclusion reached. > > The next thing I did was strip out the use of '.args' and make > > BaseException take a single argument that gets assigned to 'message'. > > The fruits of this labour are in the p3yk_no_args_on_exc branch. This > > one turned out to be a pain in the rear. > [snip] > > I took at stab at this same conversion a few weeks ago and had the > exact same experience. I ended up resolving my frustration by applying > "svn revert" and working on something else : ) > =) The people at the sprint (especially days 2 and 3) got to hear my frustrations constantly. > I think this will shape up to be one of the harder parts of porting > from 2.x to 3.0. > I agree, which is why I am asking if people are still supportive of this? Are you, Collin? > > As for transforming the 'args' accesses to something else, > > I guess 2to3 could automatically do 'args[0]' accesses to 'message', > > but anything else will need to be changed by hand. > > There's very little 2to3 can do on this front. I think 2.6's > py3k-compat flag is going to be the best bet for this particular > conversion. I think the slice removal is easy. But getting rid of 'args' and making BaseException's constructor only take a single argument is not painless. But a warning should help get this done in a reasonable fashion. -Brett _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com