[bitbake-devel] [PATCH 4/4] siggen: properly close files rather than opening them inline
Paul Eggleton
paul.eggleton at linux.intel.com
Tue Aug 16 22:30:05 UTC 2016
On Tue, 16 Aug 2016 21:16:17 Peter Kjellerstedt wrote:
> > -----Original Message-----
> > From: bitbake-devel-bounces at lists.openembedded.org [mailto:bitbake-
> > devel-bounces at lists.openembedded.org] On Behalf Of Paul Eggleton
> > Sent: den 11 augusti 2016 05:37
> > To: bitbake-devel at lists.openembedded.org
> > Subject: [bitbake-devel] [PATCH 4/4] siggen: properly close files
> > rather than opening them inline
> >
> > If you don't do this, with Python 3 you get a warning on exit under some
> > circumstances.
> >
> > Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
> > ---
> >
> > lib/bb/siggen.py | 15 +++++++++------
> > 1 file changed, 9 insertions(+), 6 deletions(-)
> >
> > diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py
> > index 5d8a253..9b2f658 100644
> > --- a/lib/bb/siggen.py
> > +++ b/lib/bb/siggen.py
> >
> > @@ -363,10 +363,12 @@ def clean_basepaths_list(a):
> > def compare_sigfiles(a, b, recursecb = None):
> > output = []
> >
> > - p1 = pickle.Unpickler(open(a, "rb"))
> > - a_data = p1.load()
> > - p2 = pickle.Unpickler(open(b, "rb"))
> > - b_data = p2.load()
> > + with open(a, 'rb') as f:
> > + p1 = pickle.Unpickler(ff)
>
> ^^
> Shouldn't that be:
>
> p1 = pickle.Unpickler(f)
>
Oops - yes it should be. I guess it just proves that even "simple, obvious"
changes like this one do actually need to be tested. I'll send a v2.
Thanks,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
More information about the bitbake-devel
mailing list