Python 3 imports: try importing Python 3 version before resorting to using Python 2 names (PR #8606)
Attempt to import python 2 module name first, and then import Python 3 version for performance considerations. This can be changed for the first Python 3 release.
* Python 3: import _winreg > winreg. Re #8527.
Python 3 introduces winreg - just _winreg without the leading underscore. Thus use the new import form:
>>> try:
>>> import winreg
>>> except ImportError:
>>> import _winreg as winreg
Note: spaces were used for this fragment.
This change allows NVDA to work with Python 2 or 3 version of winreg module. Also, code that uses (_)winreg module has been modified to call winreg.something.
* Queue handler: import Queue -> queue. Re #8527.
Python 3 ships with queue (lowercase queue). This module is used in three places: queue handler, JaB handler, and Espeak module. For this commit, queue handler has been modified to import Python 3's queue first before resorting to loading Queue.queue (Python 2). JAB and Espeak will be done on a separate commit due to extensive edits required (these use Python 2 module directly).
* Espeak internal module: import Queue > queue. Re #8527.
Python 3 renames Queue to queue, and internal Espeak module imports this directly. Thus try loading Python 3 version first before resorting to useing Python 2 name.
* JAB handler: import Queue > queue. re #8527.
* App modules/aliases: use relative imports of the form 'from .appmod import *'. Re #8649.
* Python 3/imports: use relative import of the form 'from .mod import something'. Re #8590.