jenkins-bot has submitted this change and it was merged.

Change subject: [bugfix] Extract pathname for python 2.7 too
......................................................................


[bugfix] Extract pathname for python 2.7 too

Solves unexprected AssertionError in bot.py

Bug: T89233
Change-Id: I07d55ba7082f54990f7ee33b48fca30a3776428d
---
M pywikibot/bot.py
1 file changed, 3 insertions(+), 3 deletions(-)

Approvals:
  John Vandenberg: Verified; Looks good to me, approved
  Xqt: Verified
  jenkins-bot: Verified



diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index e255580..22e614f 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -107,13 +107,13 @@
         """Strip trailing newlines before outputting text to file."""
         # Warnings captured from the warnings system are not processed by
         # logoutput(), so the 'context' variables are missing.
-        # The same context details are provided by Python 2.7, but need to
-        # be extracted from the warning message for Python 2.6.
+        # The same context details are provided by Python 3.X, but need to
+        # be extracted from the warning message for Python <= 2.7.
         if record.name == 'py.warnings' and 'caller_file' not in 
record.__dict__:
             assert(len(record.args) == 1)
             msg = record.args[0]
 
-            if sys.version_info < (2, 7):
+            if sys.version_info[0] < 3:
                 record.pathname = msg.partition(':')[0]
                 record.lineno = msg.partition(':')[2].partition(':')[0]
                 record.module = msg.rpartition('/')[2].rpartition('.')[0]

-- 
To view, visit https://gerrit.wikimedia.org/r/189944
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I07d55ba7082f54990f7ee33b48fca30a3776428d
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <i...@gno.de>
Gerrit-Reviewer: John Vandenberg <jay...@gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhall...@arctus.nl>
Gerrit-Reviewer: XZise <commodorefabia...@gmx.de>
Gerrit-Reviewer: Xqt <i...@gno.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
Pywikibot-commits mailing list
Pywikibot-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to