Skip to content

Indentation error while parsing version-conditional imports #178

Open
@achimnol

Description

@achimnol

With autodoc (.. automodule:: ...),

if sys.version_info < (3, 8, 0):
    from typing_extensions import Literal  # this line
else:
    from typing import Literal

causes "expected indented block" error.

To Reproduce
Steps to reproduce the behavior:

<Paste your command-line here which cause the problem>

$ git clone https://github.com/achimnol/aiotools
$ cd aiotools
$ pip install -r requirements/dev.txt
$ cd docs
$ make html

Expected behavior
It should build the docs.

Screenshots
image

Environment info

  • OS: Linux (Ubuntu 20.04)
  • Python version: 3.9.5
  • Sphinx version: 4.0.1, 4.1.0dev installed from GitHub
  • Sphinx extensions: sphinx.ext.autodoc, sphinx_autodoc_typehints

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions