Content-Length: 285891 | pFad | https://github.com/python/cpython/issues/92986

A0 None is not a valid value for ast.ImportFrom.level · Issue #92986 · python/cpython · GitHub
Skip to content

None is not a valid value for ast.ImportFrom.level #92986

@hauntsaninja

Description

@hauntsaninja

For example:

import ast
tree = ast.parse("from x import y")
tree.body[0].level = None
ast.unparse(tree)  # raises

This is very similar to https://bugs.python.org/issue46289 and #30467 cc @isidentical

Note the compiler does seem to allow it, but it's always an int in practice and documented as such

Discovered in typeshed.

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/92986

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy