Skip to content

Conversation

@MeGaGiGaGon
Copy link
Contributor

Summary

Part of #18972

This PR makes deprecated-c-element-tree (UP023)'s example error out-of-the-box. I have no clue why the import xml.etree.cElementTree and from xml.etree import cElementTree cases are specifically carved out if they do not have an as ..., but the tests explicitly call this out, and that's how it is in pyupgrade's source as well.

# This should fix the second, but not the first invocation.
import xml.etree.cElementTree, xml.etree.cElementTree as ET
# The below items should NOT be changed.
import xml.etree.cElementTree
from .xml.etree.cElementTree import XML
from xml.etree import cElementTree

Old example

from xml.etree import cElementTree

New example

from xml.etree import cElementTree as ET

The "Use instead" section was also updated similarly.

Test Plan

N/A, no functionality/tests affected

@github-actions
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Collaborator

@dylwil3 dylwil3 left a comment

Choose a reason for hiding this comment

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

Thanks!

@dylwil3 dylwil3 merged commit 6660b11 into astral-sh:main Jul 11, 2025
35 checks passed
@dylwil3 dylwil3 added the documentation Improvements or additions to documentation label Jul 11, 2025
@MeGaGiGaGon MeGaGiGaGon deleted the patch-4 branch July 11, 2025 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants