John Vandenberg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/291523

Change subject: Clear exceptions in BaseBot.run before processing
......................................................................

Clear exceptions in BaseBot.run before processing

Bot classes use sys.exc_info, which can be a stale exception
under Python 2.

Bug: T136487
Change-Id: I01311cf9071ab45cb38bc5463153e887a76c5138
---
M pywikibot/bot.py
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/23/291523/1

diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 7dbb8ef..378f2b2 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1414,6 +1414,10 @@
         if PY2:
             maxint = sys.maxint
 
+            # Python 2 does not clear previous exceptions and method `exit`
+            # relies on sys.exc_info returning exceptions occurring in `run`.
+            sys.exc_clear()
+
         try:
             for page in self.generator:
                 try:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I01311cf9071ab45cb38bc5463153e887a76c5138
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jay...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to