Skip to content

Fix several ResourceWarning: unclosed file

Hello,

This is a patch to fix such warnings:

/usr/bin/apt-listchanges:51: ResourceWarning: unclosed file <_io.TextIOWrapper name=20 mode='rt' encoding='UTF-8'>
  debs = ALCApt.AptPipeline(config).read()

/usr/share/apt-listchanges/DebianFiles.py:116: ResourceWarning: unclosed file <_io.TextIOWrapper name='/var/lib/dpkg/status' mode='r' encoding='utf-8'>
  self.stanzas += [ControlStanza(x) for x in open(file, 'r', encoding='utf-8', errors='replace').read().split('\n\n') if x]

Do you have some tests to ensure the patch is OK? make test passes but it will not help if I introduced an error :/

Signed-off-by: Mickaël Schoentgen contact@tiger-222.fr

Edited by Mickaël Schoentgen

Merge request reports

Loading