On Sun, Jan 13, 2013 at 03:35:13PM +0100, Ewoud Kohl van Wijngaarden wrote:
> On Sun, Jan 13, 2013 at 03:39:57PM +0200, Dan Kenigsberg wrote:
> > On Sun, Jan 13, 2013 at 04:40:11PM +0400, Andrey Gordeev wrote:
> > > On Fri, Jan 11, 2013 at 12:42 AM, Dan Kenigsberg <dan...@redhat.com> 
> > > wrote:
> > > > I've posted http://gerrit.ovirt.org/#/c/10893/ which is taken from a
> > > > former patchset of yours - is it intentionally missing form the 3.2
> > > > version of your patchset?
> > > >
> > > > > From adf7dc96767783ab81993504267c3cfd65b4c1bb Mon Sep 17 00:00:00 2001
> > > > > From: Andrey Gordeev <dre...@gmail.com>
> > > > > Date: Fri, 7 Dec 2012 13:12:19 +0400
> > > > > Subject: [PATCH 1/2] CentOS 6.2 changes
> > > > >
> > > > > ---
> > > > >      if mtu:
> > > > >          mtu = int(mtu)
> > > > >
> > > > > diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
> > > > > index 17d38ee..ada3196 100644
> > > > > --- a/vdsm/storage/misc.py
> > > > > +++ b/vdsm/storage/misc.py
> > > > > @@ -748,7 +748,7 @@ class RollbackContext(object):
> > > > >
> > > > >          # re-raise the earliest exception
> > > > >          if firstException is not None:
> > > > > -            raise firstException, None, traceback
> > > > > +            raise firstException(None, traceback)
> > > >
> > > > I do not believe that it is correct - is it only to satisfy old pep8
> > > > tool not recognizing the peculiar "raise" syntax that is used here?
> > > > Could you ship
> > > > http://danken.fedorapeople.org/python-pep8-1.3.3-3.el6.noarch.rpm
> > > > instead?
> > > >
> > > >
> > > Yes, I hope.
> >
> > Thanks. I still hope that someone rebases EPEL's pep8 to something more
> > modern and without the "raise" bug. Maybe iweller could help!
> 
> So I'd take this patch upstream and not worry about the newer pep
> version because the latter syntax is the better choice since the former
> is no longer allowed in python 3. See
> http://docs.pythonsprints.com/python3_porting/py-porting.html#exceptions

No, this is impossible. Zhou Zheng Sheng code attempted to raise the
firstException with its original exception. In Python 3, the traceback
is part of the Excpetion object. Thus,

    raise firstException

would be enough. However, afaik, Python 2 has no equivalent, and
requires us to use the extraordinary

    raise firstException, None, traceback

construct. The suggested syntax is wrong, as it attempts ot call a
non-callable object.

Dan.
_______________________________________________
vdsm-devel mailing list
vdsm-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-devel

Reply via email to