On Wed, Apr 08, 2009 at 04:35:56PM -0700, [email protected] wrote:

> I guess I was concerned about the case where you get an OSError that
> doesn't have the errno attribute.  You'd probably want to re-raise that
> error, but not a MemoryError.

Okay, I think I see where your logic is -- if I get such an exception, then
I'm not re-raising it, even though I should, because it's not an
OOM-related exception.  In that case, the logic should probably be:

  if isinstance(__e, EnvironmentError) and \
      ((if hasattr(__e, "errno") and __e.errno != errno.ENOMEM) or
      not hasattr(__e, "errno")):
          raise

  ...

Danek

> According to the EnvironmentError exception's description, it's possible
> that errno won't be set.
> 
>       http://www.python.org/doc/2.4.4/lib/module-exceptions.html

I read that as the member will always be there, just sometimes set to None,
in which case

    if isinstance(__e, EnvironmentError) and __e.errno != errno.ENOMEM:
        raise

    ...

should work, no?

Danek
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to