Skip to content

Conversation

@LaBatata101
Copy link
Contributor

Summary

Contains the same changes to the semantic type inference as #17705.

Fixes #17693.

Test Plan

Snapshot tests.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 29, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre
Copy link
Contributor

ntBre commented Apr 29, 2025

I'll review this, but let's merge #17705 first to get the shared changes and then update this PR :)

Same with #17712.

@LaBatata101
Copy link
Contributor Author

Fixing the merge conflicts

@MichaReiser MichaReiser added bug Something isn't working rule Implementing or modifying a lint rule labels Apr 30, 2025
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Thanks. We should probably exclude bytes string from this change as discussed on the issue, Sorry about that

@LaBatata101
Copy link
Contributor Author

LaBatata101 commented Apr 30, 2025

Thanks. We should probably exclude bytes string from this change as discussed on the issue, Sorry about that

Alright, no problem. So, should I remove the bytes string changes from the other PTH* rules as well?

@dhruvmanila
Copy link
Member

I realized that the refactor that I did in #17715 will cause merge conflicts in your PRs, I'll resolve them.

@LaBatata101 LaBatata101 changed the title [flake8-use-pathlib] Fix PTH116 false positive when stat is passed a file descriptor or bytes string [flake8-use-pathlib] Fix PTH116 false positive when stat is passed a file descriptor Apr 30, 2025
@MichaReiser
Copy link
Member

Alright, no problem. So, should I remove the bytes string changes from the other PTH* rules as well?

That would be great, yes

@MichaReiser MichaReiser merged commit 67ef370 into astral-sh:main May 1, 2025
34 checks passed
dcreager added a commit that referenced this pull request May 1, 2025
* main:
  Improve messages outputted by py-fuzzer (#17764)
  [`red-knot`] Allow subclasses of Any to be assignable to Callable types (#17717)
  [red-knot] Increase durability of read-only `File` fields (#17757)
  [red-knot] Cache source type during semanic index building (#17756)
  [`flake8-use-pathlib`] Fix `PTH116` false positive when `stat` is passed a file descriptor (#17709)
  Sync vendored typeshed stubs (#17753)
@LaBatata101 LaBatata101 deleted the fix-PTH116 branch May 8, 2025 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PTH116 suggests Path.stat() which does not support file descriptors

4 participants