Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-142349: Fix ast.unparse for lazy import statements#144893

Merged
pablogsal merged 1 commit into
python:mainpython/cpython:mainfrom
pablogsal:unparse-lazypablogsal/cpython:unparse-lazyCopy head branch name to clipboard
Feb 16, 2026
Merged

gh-142349: Fix ast.unparse for lazy import statements#144893
pablogsal merged 1 commit into
python:mainpython/cpython:mainfrom
pablogsal:unparse-lazypablogsal/cpython:unparse-lazyCopy head branch name to clipboard

Conversation

@pablogsal

@pablogsal pablogsal commented Feb 16, 2026

Copy link
Copy Markdown
Member

The unparser was not handling the is_lazy attribute on Import and
ImportFrom AST nodes, causing lazy imports to be unparsed as regular
imports. This broke the round-trip (parse → unparse → reparse) for
any file containing lazy import statements.

The unparser was not handling the `is_lazy` attribute on Import and
ImportFrom AST nodes, causing lazy imports to be unparsed as regular
imports. This broke the round-trip (parse → unparse → reparse) for
any file containing `lazy import` statements.

@itamaro itamaro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be covered by additional unittests?

@pablogsal

Copy link
Copy Markdown
Member Author

Should this be covered by additional unittests?

For now I am landing this to stop the inevitable failure in all the buildbots that build with -uall we can then add unittest later

@pablogsal pablogsal merged commit 18c04f2 into python:main Feb 16, 2026
53 checks passed
@pablogsal pablogsal deleted the unparse-lazy branch February 16, 2026 22:57
brijkapadia pushed a commit to brijkapadia/cpython that referenced this pull request Feb 28, 2026
…44893)

The unparser was not handling the `is_lazy` attribute on Import and
ImportFrom AST nodes, causing lazy imports to be unparsed as regular
imports. This broke the round-trip (parse → unparse → reparse) for
any file containing `lazy import` statements.
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
…44893)

The unparser was not handling the `is_lazy` attribute on Import and
ImportFrom AST nodes, causing lazy imports to be unparsed as regular
imports. This broke the round-trip (parse → unparse → reparse) for
any file containing `lazy import` statements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.