jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] editor: Close temporary file handle
......................................................................
[FIX] editor: Close temporary file handle
When using `mkstemp` the file handle must be closed before removing the file.
This was first fixed with 3a4d1844 but the `editor` module also uses `mkstemp`
and is not closing the handle.
Change-Id: I773aff3000fa26b04dcc9b5151fe11a726c0247c
---
M pywikibot/editor.py
1 file changed, 3 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/editor.py b/pywikibot/editor.py
index 4ccf779..bef3119 100644
--- a/pywikibot/editor.py
+++ b/pywikibot/editor.py
@@ -95,7 +95,8 @@
@rtype: unicode or None
"""
if config.editor:
- tempFilename = '%s.%s' % (tempfile.mkstemp()[1],
+ handle, tempFilename = tempfile.mkstemp()
+ tempFilename = '%s.%s' % (tempFilename,
config.editor_filename_extension)
try:
with codecs.open(tempFilename, 'w',
@@ -113,6 +114,7 @@
newcontent = temp_file.read()
return newcontent
finally:
+ os.close(handle)
os.unlink(tempFilename)
if isinstance(gui, ImportError):
--
To view, visit
https://gerrit.wikimedia.org/r/239561
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I773aff3000fa26b04dcc9b5151fe11a726c0247c
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>