| Dalba added a comment. |
I believe the issue is in pywikibot/userinterfaces/terminal_interface_base.py:TerminalHandler.emit. Specifically the following lines:
# 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]),)
Here, because the warning source contains "exceptions." the last (and only) line is removed which results in an empty warning message.
I think the method used here to remove the warn call from output is too risky and is not worth it. AFAK we usually fix the stacklevel in our warning decorators (see the source code for issue_deprecation_warning for example). In the case that we didn't, it seems that should fix the code. Until the code is fixed, seeng the warn line does not hurt as much as loosing the whole warning message.
I'm going to propose to remove those lines.
TASK DETAIL
EMAIL PREFERENCES
To: Dalba
Cc: Xqt, Aklapper, Dvorapa, pywikibot-bugs-list, Dalba, Magul, Tbscho, rafidaslam, MayS, Mdupont, JJMC89, Avicennasis, jayvdb, Masti, Alchimista, Rxy
Cc: Xqt, Aklapper, Dvorapa, pywikibot-bugs-list, Dalba, Magul, Tbscho, rafidaslam, MayS, Mdupont, JJMC89, Avicennasis, jayvdb, Masti, Alchimista, Rxy
_______________________________________________ pywikibot-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs
