Skip to content

[pyupgrade] Document more fix unsafety for UP007#9306

Merged
charliermarsh merged 1 commit into
astral-sh:mainfrom
hauntsaninja:up007-unsafe
Dec 29, 2023
Merged

[pyupgrade] Document more fix unsafety for UP007#9306
charliermarsh merged 1 commit into
astral-sh:mainfrom
hauntsaninja:up007-unsafe

Conversation

@hauntsaninja

@hauntsaninja hauntsaninja commented Dec 29, 2023

Copy link
Copy Markdown
Contributor
from typing import Optional
x = "asdf"
def foo(a: Optional[x]):
    pass

It's not uncommon to see issues like this with multiprocessing, where things are actually methods instead of types

Relates to #8482

```
from typing import Optional
x = "asdf"
def foo(a: Optional[x]):
    pass
```
@github-actions

Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@charliermarsh charliermarsh added the documentation Improvements or additions to documentation label Dec 29, 2023
@charliermarsh charliermarsh merged commit ec88acc into astral-sh:main Dec 29, 2023
@charliermarsh

Copy link
Copy Markdown
Member

Thanks!

@hauntsaninja hauntsaninja deleted the up007-unsafe branch December 29, 2023 18:35
ntBre added a commit to adityasingh2400/ruff that referenced this pull request May 21, 2026
for future reference, I think the "unusal and likely incorrect" part of this should probably be in a
separate Known Issues section, as I don't think this is isolated to Python versions before 3.10,
and the code doesn't actually check anything about the types to determine fix safety.

astral-sh#9306 added this phrase, which I think is worth having
somewhere, just not necessarily in this section
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