jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/341201 )
Change subject: Avoid ResourceWarning using subprocess in python 3.6 ......................................................................
Avoid ResourceWarning using subprocess in python 3.6
Bug: T159646 Change-Id: I41779be701cdef29c5a42a2702903e56893260a1 --- M pywikibot/version.py 1 file changed, 6 insertions(+), 6 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/pywikibot/version.py b/pywikibot/version.py index 2cc8ba3..3025532 100644 --- a/pywikibot/version.py +++ b/pywikibot/version.py @@ -298,21 +298,21 @@ tag = tag[(s + 6):e] t = tag.strip().split('/') tag = '[%s] %s' % (t[0][:-1], '-'.join(t[3:])) - with subprocess.Popen([cmd, '--no-pager', + dp = subprocess.Popen([cmd, '--no-pager', 'log', '-1', '--pretty=format:"%ad|%an|%h|%H|%d"' '--abbrev-commit', '--date=iso'], cwd=_program_dir, - stdout=subprocess.PIPE).stdout as stdout: - info = stdout.read() + stdout=subprocess.PIPE) + info, stderr = dp.communicate() info = info.decode(config.console_encoding).split('|') date = info[0][:-6] date = time.strptime(date.strip('"'), '%Y-%m-%d %H:%M:%S') - with subprocess.Popen([cmd, 'rev-list', 'HEAD'], + dp = subprocess.Popen([cmd, 'rev-list', 'HEAD'], cwd=_program_dir, - stdout=subprocess.PIPE).stdout as stdout: - rev = stdout.read() + stdout=subprocess.PIPE) + rev, stderr = dp.communicate() rev = 'g%s' % len(rev.splitlines()) hsh = info[3] # also stored in '.git/refs/heads/master' if (not date or not tag or not rev) and not path:
pywikibot-commits@lists.wikimedia.org