Skip to content

Commit e0889be

Browse files
hauntsaninjatushar-deepsource
authored andcommitted
stubgen: use sys.version_info, rather than hardcoding 3.6 (python#10907)
Not too familiar with stubgen, so maybe there's a good reason for hardcoding, e.g. to ensure stubs capture sys.version checks in the source? Most stubs in typeshed use sys.version checks for a) checking Python 2, b) if they're stdlib backports. So hopefully this is a reasonable change. Fixes python#10905
1 parent 8ba7336 commit e0889be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/stubgen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,7 @@ def parse_options(args: List[str]) -> Options:
16611661

16621662
ns = parser.parse_args(args)
16631663

1664-
pyversion = defaults.PYTHON2_VERSION if ns.py2 else defaults.PYTHON3_VERSION
1664+
pyversion = defaults.PYTHON2_VERSION if ns.py2 else sys.version_info[:2]
16651665
if not ns.interpreter:
16661666
ns.interpreter = sys.executable if pyversion[0] == 3 else default_py2_interpreter()
16671667
if ns.modules + ns.packages and ns.files:

0 commit comments

Comments
 (0)