Skip to content

Pydantic documentation python interpreter issue. #5

@maksym-petrenko

Description

@maksym-petrenko

Interpreter fails when deals with nested loops or functions. Noticed in issue. Also, it fails to run the following code(just a simple example):

def f(x):
    for i in range(x):
        print(i)

and returns this output:

pydantic version: v2.6.1, pydantic-core version: v2.16.2
Traceback (most recent call last):
  File "/lib/python311.zip/_pyodide/_base.py", line 144, in _parse_and_compile_gen
    mod = compile(source, filename, mode, flags | ast.PyCF_ONLY_AST)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "", line 3
    print(i)
IndentationError: expected an indented block after 'for' statement on line 2

This applies to all codeblocks with nested functions | classes | loops I tested.

Note: It is also triggered by nested if else statements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions