jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/402650 )
Change subject: TerminalHandler.emit: Do not omit the last line even if it seems to be warn() ......................................................................
TerminalHandler.emit: Do not omit the last line even if it seems to be warn()
In T184368 we have a case that useful warning info are removed from the output. This patch removes the lines responsible for removing the last line of a warning message that appears to be a warn call.
In Pywikibot we usually fix warning stacklevel inside the warning decorators (e.g. in issue_deprecation_warning). Even if we did not, we can fix the code. Therefore, it seems unnecessary to remove the last line, especially with the risk of removing useful information.
Bug: T184368 Change-Id: Iaf4b1dfb8939ce76b670e44f882e45504279a60a --- M pywikibot/userinterfaces/terminal_interface_base.py 1 file changed, 0 insertions(+), 9 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py index c37cc9e..7bc017c 100755 --- a/pywikibot/userinterfaces/terminal_interface_base.py +++ b/pywikibot/userinterfaces/terminal_interface_base.py @@ -510,15 +510,6 @@ if 'message' in record.__dict__: return
- # Remove the last line, if it appears to be the warn() call - msg = record.args[0] - is_useless_source_output = any( - s in msg for s in - (str('warn('), str('exceptions.'), str('Warning)'), str('Warning,'))) - - if is_useless_source_output: - record.args = ('\n'.join(record.args[0].splitlines()[0:-1]),) - if 'newline' not in record.__dict__: record.__dict__['newline'] = '\n'
pywikibot-commits@lists.wikimedia.org