[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Resource leak in uic/objcreator.py
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2015-05-18 16:41:48
Message-ID: c74f68eef9973f95aa9ab15a7e9377b8 () riverbankcomputing ! com
[Download RAW message or body]

On 14/05/2015 11:43 am, Dmitry Shachnev wrote:
> Hi,
> 
> In Ubuntu we usually run tests with PYTHONWARNINGS=d, and we get a lot 
> of
> warnings like this for some packages, when running pyuic5:
> 
> /usr/lib/python3/dist-packages/PyQt5/uic/objcreator.py:91:
> DeprecationWarning: 'U' mode is deprecated
>   if load_plugin(open(filename, 'rU'), plugin_globals, plugin_locals):
> /usr/lib/python3/dist-packages/PyQt5/uic/objcreator.py:91:
> ResourceWarning: unclosed file <_io.TextIOWrapper
> name='/usr/lib/python3/dist-packages/PyQt5/uic/widget-plugins/qtprintsupport.py'
> mode='rU' encoding='ANSI_X3.4-1968'>
>   if load_plugin(open(filename, 'rU'), plugin_globals, plugin_locals):
> /usr/lib/python3/dist-packages/PyQt5/uic/objcreator.py:91:
> ResourceWarning: unclosed file <_io.TextIOWrapper
> name='/usr/lib/python3/dist-packages/PyQt5/uic/widget-plugins/qtquickwidgets.py'
> mode='rU' encoding='ANSI_X3.4-1968'>
>   if load_plugin(open(filename, 'rU'), plugin_globals, plugin_locals):
> [...]
> 
> See for example log at [1].
> 
> While the deprecation warning is harmless and unavoidable in a Python 
> 2/3 code,
> the resource warnings can be easily fixed creating a file variable and 
> calling
> close() on it when it is no longer needed. Can you please do that?

Should be fixed in tonight's PyQt4 and PyQt5 snapshots.

Thanks,
Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic