Hi,
The overall picture is powered by #7105:
Background:
For a number of years, NV Access and the community have been thinking about moving NVDA's source code to Python 3. The prerequisite for this work has been preparation of Python 3 versions of various dependencies, the biggest ones being wxPython, SCons, py2exe, ConfigObj and many others.
In July 2018, NVDA was switched to use wxPython 4.0.3, a milestone in Python 3 transition planning. This lays the theoretical foundation to transitoin to Python 3, specifically Python 3.7. As noted in issue #7105, NVDA 2018.3 is considered "version N", with research and porting to take place in the very near future (ideally throughout 2019).
Specific issue at hand:
At the moment NVDA imports Python 2 versions of various modules. However, in Python 3, some of them are renamed. The most notable case being "_winreg", which has been renamed to "winreg" (without the underscore). Some fragments use aliased import (of the form "import _winreg as winreg"), while others import this module directly. There are other renamed modules, but winreg is the most notable one.
Thus it is proposed to do two things:
- Unify the import statements.
- Try importing Python 3 name first, and if it fials, resort to Python 2.
Applying this to _winreg:
Old:
New:
try:
import winregexcept ImportError:
import _winreg as winreg
Which then allows winreg functions and attributes to be accessed via Python 3 name.
Note that for the rest of the template, because this issue concerns future work, most fields are not applicable.
Steps to reproduce:
Import various modules that have both Python 2 and 3 implementations, or are renamed in Python 3.
Name and version of other software in use when reproducing the issue:
Python 2.7.15, Python 3.7.0
Hi,
The overall picture is powered by #7105:
Background:
For a number of years, NV Access and the community have been thinking about moving NVDA's source code to Python 3. The prerequisite for this work has been preparation of Python 3 versions of various dependencies, the biggest ones being wxPython, SCons, py2exe, ConfigObj and many others.
In July 2018, NVDA was switched to use wxPython 4.0.3, a milestone in Python 3 transition planning. This lays the theoretical foundation to transitoin to Python 3, specifically Python 3.7. As noted in issue #7105, NVDA 2018.3 is considered "version N", with research and porting to take place in the very near future (ideally throughout 2019).
Specific issue at hand:
At the moment NVDA imports Python 2 versions of various modules. However, in Python 3, some of them are renamed. The most notable case being "_winreg", which has been renamed to "winreg" (without the underscore). Some fragments use aliased import (of the form "import _winreg as winreg"), while others import this module directly. There are other renamed modules, but winreg is the most notable one.
Thus it is proposed to do two things:
Applying this to
_winreg:Old:
New:
Which then allows winreg functions and attributes to be accessed via Python 3 name.
Note that for the rest of the template, because this issue concerns future work, most fields are not applicable.
Steps to reproduce:
Import various modules that have both Python 2 and 3 implementations, or are renamed in Python 3.
Name and version of other software in use when reproducing the issue:
Python 2.7.15, Python 3.7.0