One quick nit: line 1426 has a ; at the end of it, can that be removed?

An UnboundLocalError can happen in this case when mkstemp was what 
raised the exception in the first place right since that means that ptmp 
isn't set, right? If so, can you add a comment to that effect?

I'm fine with this going back as is, but I think the code might be 
clearer if the try block was broken apart. The first one would try to 
make the tmp file and, if there was an exception, return (at least I 
think that's the current behavior).

Actually, if try block only contained the mktemp call, and returned in 
the except block, wouldn't that mean that 'pf = os.fdopen(...)' could be 
moved outside of the try block, or can mkstemp create temp files that 
are unwritable? If not, then I think this entire region can be 
simplified to:


try:
        pfd, ptmp = \
            tempfile.mkstemp(dir=os.path.dirname(pickle_file))
except EnvironmentError:
        return
pf = os.fdopen(pfd, "wb")
 


Wouldn't that accomplish the same goals?

Brock

Danek Duvall wrote:
> I just filed
>
>     4492 fix for bug 4447 can result in UnboundLocalError
>
> as I appear not to have tested my fix for bug 4447 properly.  The fix is
> super simple, and yes, I've tested it this time.  Webrev is at:
>
>     http://cr.opensolaris.org/~dduvall/pkg-bug4492/
>
> Thanks,
> Danek
> _______________________________________________
> pkg-discuss mailing list
> [email protected]
> http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
>   

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

Reply via email to