Skip to content

stubgen does not support debug f-strings using python 3.9+ #11296

Closed
@rvaquerizor

Description

@rvaquerizor

Bug Report

I get an error like the following whenever a debug f-string is used in my code and I try to generate a stub to by used with mypy:

Critical error during semantic analysis: myfile.py:76: error: f-string: self documenting expressions are only supported in Python 3.8 and greater

To Reproduce

  1. Put a debug string in your code, like the following:
option = 3
print(f'Debug print: {option=}')
  1. execute stubgen on it, and it will complain with the above error message

Expected Behavior

Debug f-strings supported by stubgen, as long as py3.8+ is used.

Actual Behavior

stubgen fails to generate the pyi file when debug f-strings are found in the py module.

Your Environment

  • Mypy version used: 0.812
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.9 and 3.10
  • Operating system and version: Ubuntu, 5.11.0-37-generic Refactor code into packages #41-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions