WebSafe 3.7github.com
|
|
🏠
Skip to content

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

Merged
pablogsal merged 1 commit intopython:mainfrom
pablogsal:unparse-lazy
Feb 16, 2026
Merged

gh-142349: Fix ast.unparse for lazy import statements#144893
pablogsal merged 1 commit intopython:mainfrom
pablogsal:unparse-lazy

Conversation

@pablogsal
Copy link
Member

@pablogsal pablogsal commented Feb 16, 2026

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.
Copy link
Contributor

@itamaro itamaro left a comment

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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants

Comments