Mercurial > cgi-bin > hgweb.cgi > curlyq
changeset 14:152f6aa87d62
Plug a memoryview leak.
author | David Barts <n5jrn@me.com> |
---|---|
date | Fri, 27 Dec 2019 13:30:44 -0800 |
parents | 6acda841a690 |
children | 0be0586104b7 |
files | runes.py |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/runes.py Fri Dec 27 13:23:07 2019 -0800 +++ b/runes.py Fri Dec 27 13:30:44 2019 -0800 @@ -155,12 +155,15 @@ view = memoryview(self.buffer) try: ret = view[key] - if isinstance (ret, int): - return chr(ret) - elif isinstance(ret, memoryview): - return self.codec.decode(ret, 'replace')[0] - else: - raise AssertionError("this shouldn't happen") + try: + if isinstance (ret, int): + return chr(ret) + elif isinstance(ret, memoryview): + return self.codec.decode(ret, 'replace')[0] + else: + raise AssertionError("this shouldn't happen") + finally: + ret.release() except IndexError: return "" finally: