jenkins-bot merged this change.

View Change

Approvals: Framawiki: Looks good to me, approved jenkins-bot: Verified
[cleanup] Remove maxint error message

BaseBot._treat_counter does never exceed maxint limit because
Python 2 yield plain integers unless the value is too large to
be represented as a plain integer, in which case it yield a
long integer. Therefore remove that error message.

Change-Id: Ic974854c9d31201c58668f9a454f500aa32cffb9
---
M pywikibot/bot.py
1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 9721ded..68fdd5d 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1466,13 +1466,11 @@
raise NotImplementedError('Variable %s.generator not set.'
% self.__class__.__name__)

- maxint = 0
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()
+
self.setup()
try:
for item in self.generator:
@@ -1504,14 +1502,7 @@

# Process the page
self.treat(page)
-
self._treat_counter += 1
- if maxint and self._treat_counter == maxint:
- # Warn the user that the bot may not function correctly
- pywikibot.error(
- '\n%s: page count reached Python 2 sys.maxint (%d).\n'
- 'Python 3 should be used to process very large batches'
- % (self.__class__.__name__, sys.maxint))
else:
self._generator_completed = True
except GeneratorExit:

To view, visit change 462162. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic974854c9d31201c58668f9a454f500aa32cffb9
Gerrit-Change-Number: 462162
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Framawiki <framawiki@tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: jenkins-bot (75)