Skip to content

Conversation

@MeGaGiGaGon
Copy link
Contributor

@MeGaGiGaGon MeGaGiGaGon commented Jun 30, 2025

Summary

This PR fixes #19047 / the isinstance-type-none (FURB168) tuple false positive by adding a check if the tuple is empty to the code. I also noticed there was another false positive with the other tuple check in the same function, so I fixed it the same way. Union[()] is invalid at runtime with TypeError: Cannot take a Union of no types., but it is accepted by basedpyright playground and is equivalent to Never, so I fixed it anyways. I'm getting on a side tangent here, but it looks like MyPy doesn't accept it, and ty playground gives @Todo.

Test Plan

Added two test cases for the two false positives. playground

@MeGaGiGaGon MeGaGiGaGon changed the title Fix furb168 empty tuple false positive [refurb] Fix FURB168 empty tuple false positive Jun 30, 2025
@github-actions
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre added bug Something isn't working rule Implementing or modifying a lint rule labels Jul 1, 2025
Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

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

Thanks!

@ntBre ntBre changed the title [refurb] Fix FURB168 empty tuple false positive [refurb] Fix false positive on empty tuples (FURB168) Jul 1, 2025
@ntBre ntBre merged commit cc736c3 into astral-sh:main Jul 1, 2025
37 checks passed
@MeGaGiGaGon MeGaGiGaGon deleted the fix-FURB168-empty-tuple-false-positive branch July 2, 2025 17:11
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.

FURB168 has false positives on empty tuples

2 participants