[bitbake-devel] [PATCH] event: prevent unclosed file warning in print_ui_queue

Christopher Larson clarson at kergoth.com
Tue Oct 4 15:00:13 UTC 2016


On Tue, Oct 4, 2016 at 3:03 AM, Joshua Lock <joshua.g.lock at intel.com> wrote:

> Use logger.addHandler(), rather than assigning an array of Handlers
> to the loggers handlers property directly, to avoid a warning from
> Python 3 about unclosed files:
>
> $ bitbake
> Nothing to do.  Use 'bitbake world' to build everything, or run 'bitbake
> --help' for usage information.
> WARNING: /home/joshuagl/Projects/poky/bitbake/lib/bb/event.py:143:
> ResourceWarning: unclosed file <_io.TextIOWrapper
> name='/home/joshuagl/Projects/poky/build/tmp/log/cooker/qemux86/20161004094928.log'
> mode='a' encoding='UTF-8'>
>   logger.handlers = [stdout]
>
> Signed-off-by: Joshua Lock <joshua.g.lock at intel.com>
>

There are valid cases to do an assignment, or at least clear out the
existing handlers via another means. We probably assigned there to ensure
it didn’t try to do anything else with the events other than dump them to
the output stream. Probably not an issue most of the time, in this case,
but worth noting. Good catch on this.
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20161004/185ea457/attachment-0002.html>


More information about the bitbake-devel mailing list