'hasattr' function on '__builtins__' for 'xrange' function does not

return correct information from a script, but works well on interactive
shell. Used a more proper check for Python > 2 instead of the current
implementation.

Thanks Vishal for the report.
This commit is contained in:
Ashesh Vashi
2016-07-12 13:21:17 +05:30
parent 6fa4065eee
commit 1ada5031cd

View File

@@ -33,7 +33,7 @@ import config
# If script is running under python3, it will not have the xrange function
# defined
winreg = None
if not hasattr(__builtins__, 'xrange'):
if sys.version_info.major >= 3:
xrange = range
if os.name == 'nt':
import winreg