jayvdb created this task.
Herald added a subscriber: Zppix.

TASK DESCRIPTION
  While testing for PyPy in setup.py, using the following, bot tests starts 
failing on Python 2.x builds.
  
    try:
        sys.pypy_version_info
        PYPY = True
    except AttributeError:
        PYPY = False
  
  It fails because `bot_tests.py` includes a guard like `exc = 
sys.exc_info()[0]; self.assertIsNone(exc)`
  
  Worth noting that while there are other `try: except:` blocks in setup.py, 
they are successful imports of `multiprocessing`, `unittest2`, `bz2` in the 
Travis environment.
  
  This has exposed the problem that `BaseBot.exit()` uses `sys.exc_info()`, 
which could be a very old stale exception on Python 2.  BaseBot has some logic 
to avoid exceptions during the bot run from remaining in sys.exc_info(), but it 
doesnt clear the exceptions from before the bot run.
  
  This isnt actually a likely bug in `BaseBot` or existing subclasses in 
`bot.py`, because it only looks for whether the old exception is 
`KeyboardInterrupt`, and it very unusual to have one of those caught and 
remaining in sys.exc_info (i.e. something permanently discarded 
`KeyboardInterrupt`, which would be bizarre) before the bot was run.
  
  However it is very likely that new subclasses, or future improvements in 
BaseBot, will use `sys.exc_info()` for other types of exceptions, and not be 
expecting old exceptions from before the bot was run.
  
  To make it more reliable, `BaseBot.run()` should clear the old exception 
before it commences process.

TASK DETAIL
  https://phabricator.wikimedia.org/T136487

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: jayvdb
Cc: Aklapper, pywikibot-bugs-list, Ricordisamoa, gerritbot, jayvdb, Zppix, 
Mdupont



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

Reply via email to