KEMBAR78
stubgen reports wrong Python version when used with debug f-string · Issue #10905 · python/mypy · GitHub
Skip to content

stubgen reports wrong Python version when used with debug f-string #10905

@Peterl777

Description

@Peterl777

Bug Report

When running stubgen on a module that contains a debug f-string, stubgen reports a "Critical error" and reports the wrong python version.

To Reproduce

# mod.py
def fn() -> int:
    i = 5
    print(f'{i=}')
    return 0

C:\> stubgen mod.py
Critical error during semantic analysis: mod.py:3: error: f-string: self documenting expressions are only supported in Python 3.8 and greater

Expected Behavior

C:\> stubgen mod.py
Processed 1 modules
Generated out\mod.pyi

Actual Behavior

C:\> stubgen mod.py
Critical error during semantic analysis: mod.py:3: error: f-string: self documenting expressions are only supported in Python 3.8 and greater

Your Environment

  • Mypy version used: 0.910
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.9.6 (no other Pythons installed)
  • Operating system and version: Win 10.0.19043

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions