Xqt has uploaded a new change for review.

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

Change subject: remove unused "global" declaration; remove obsolete stopme()
......................................................................

remove unused "global" declaration; remove obsolete stopme()

bot object is never used as global variable. The global
declaration is obsolete.

In core branch pywikibot.stopme() is called by atexit library.
The function is executed upon normal program termination. This
patch prohibits executing it twice.

Change-Id: I8d7c07cd058f6c7db236c84ab461489b5fbfc088
---
M scripts/category_redirect.py
1 file changed, 9 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/90/120190/1

diff --git a/scripts/category_redirect.py b/scripts/category_redirect.py
index 7e71e1c..48bcc93 100755
--- a/scripts/category_redirect.py
+++ b/scripts/category_redirect.py
@@ -15,7 +15,7 @@
 """
 
 #
-# (C) Pywikibot team, 2008-2013
+# (C) Pywikibot team, 2008-2014
 #
 # Distributed under the terms of the MIT license.
 #
@@ -414,18 +414,14 @@
 
 
 def main(*args):
-    global bot
-    try:
-        a = pywikibot.handleArgs(*args)
-        if len(a) == 1:
-            raise RuntimeError('Unrecognized argument "%s"' % a[0])
-        elif a:
-            raise RuntimeError('Unrecognized arguments: ' +
-                               " ".join(('"%s"' % arg) for arg in a))
-        bot = CategoryRedirectBot()
-        bot.run()
-    finally:
-        pywikibot.stopme()
+    a = pywikibot.handleArgs(*args)
+    if len(a) == 1:
+        raise RuntimeError('Unrecognized argument "%s"' % a[0])
+    elif a:
+        raise RuntimeError('Unrecognized arguments: ' +
+                           " ".join(('"%s"' % arg) for arg in a))
+    bot = CategoryRedirectBot()
+    bot.run()
 
 if __name__ == "__main__":
     main()

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8d7c07cd058f6c7db236c84ab461489b5fbfc088
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <i...@gno.de>

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

Reply via email to