Skip to content

[ty] Revert "[ty] Infer definite equality comparison results"#26308

Merged
charliermarsh merged 1 commit into
mainfrom
revert-26290-charlie/infer-equality-comparison-results
Jun 24, 2026
Merged

[ty] Revert "[ty] Infer definite equality comparison results"#26308
charliermarsh merged 1 commit into
mainfrom
revert-26290-charlie/infer-equality-comparison-results

Conversation

@charliermarsh

Copy link
Copy Markdown
Member

Reverts #26290. This was accidentally merged.

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Jun 24, 2026
@astral-sh-bot astral-sh-bot Bot changed the title Revert "[ty] Infer definite equality comparison results" [ty] Revert "[ty] Infer definite equality comparison results" Jun 24, 2026
@charliermarsh charliermarsh marked this pull request as ready for review June 24, 2026 00:34
@charliermarsh charliermarsh requested a review from a team as a code owner June 24, 2026 00:34
@charliermarsh charliermarsh added the internal An internal refactor or improvement label Jun 24, 2026
@astral-sh-bot astral-sh-bot Bot requested a review from dcreager June 24, 2026 00:34
@charliermarsh charliermarsh enabled auto-merge (squash) June 24, 2026 00:34
@astral-sh-bot

astral-sh-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 94.37%. The percentage of expected errors that received a diagnostic held steady at 89.00%. The number of fully passing files held steady at 94/134.

@astral-sh-bot

astral-sh-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

Memory usage report

Summary

Project Old New Diff Outcome
flake8 30.77MB 30.75MB -0.07% (22.12kB) ⬇️
trio 77.59MB 77.52MB -0.09% (73.31kB) ⬇️
sphinx 193.67MB 193.38MB -0.15% (301.71kB) ⬇️
prefect 516.69MB 516.30MB -0.08% (402.97kB) ⬇️

Significant changes

Click to expand detailed breakdown

flake8

Name Old New Diff Outcome
infer_expression_types_impl 967.57kB 960.88kB -0.69% (6.69kB) ⬇️
member_lookup_with_policy_inner 439.35kB 436.04kB -0.75% (3.30kB) ⬇️
Type<'db>::class_member_with_policy_ 351.38kB 348.15kB -0.92% (3.23kB) ⬇️
parsed_module 9.77MB 9.77MB -0.03% (3.09kB) ⬇️
member_lookup_with_policy_inner::interned_arguments 205.66kB 204.26kB -0.68% (1.41kB) ⬇️
TupleType<'db>::to_class_type_ 15.12kB 13.84kB -8.45% (1.28kB) ⬇️
Type<'db>::class_member_with_policy_::interned_arguments 169.20kB 167.98kB -0.72% (1.22kB) ⬇️
infer_definition_types 1.35MB 1.35MB +0.08% (1.08kB) ⬇️
Type<'db>::apply_specialization_inner_ 173.09kB 172.01kB -0.62% (1.07kB) ⬇️
Specialization 175.33kB 174.45kB -0.50% (896.00B) ⬇️
GenericAlias 76.50kB 75.87kB -0.83% (648.00B) ⬇️
Type<'db>::apply_specialization_inner_::interned_arguments 174.38kB 173.83kB -0.31% (560.00B) ⬇️
UnionType 57.20kB 56.66kB -0.96% (560.00B) ⬇️
all_narrowing_constraints_for_expression 86.72kB 87.14kB +0.49% (432.00B) ⬇️
loop_header_reachability 12.05kB 12.43kB +3.11% (384.00B) ⬇️
... 8 more

trio

Name Old New Diff Outcome
infer_expression_types_impl 6.55MB 6.51MB -0.60% (40.52kB) ⬇️
member_lookup_with_policy_inner 1.53MB 1.52MB -0.56% (8.72kB) ⬇️
parsed_module 15.04MB 15.05MB +0.05% (8.23kB) ⬇️
Type<'db>::apply_specialization_inner_ 513.09kB 509.12kB -0.77% (3.96kB) ⬇️
UnionType 145.98kB 142.09kB -2.67% (3.89kB) ⬇️
TupleType<'db>::to_class_type_ 47.32kB 43.69kB -7.68% (3.63kB) ⬇️
infer_definition_types 5.59MB 5.59MB -0.06% (3.26kB) ⬇️
Type<'db>::apply_specialization_inner_::interned_arguments 506.80kB 504.06kB -0.54% (2.73kB) ⬇️
Type<'db>::class_member_with_policy_ 1.25MB 1.25MB -0.20% (2.59kB) ⬇️
BoundMethodType 180.16kB 182.73kB +1.43% (2.58kB) ⬇️
Specialization 458.59kB 456.30kB -0.50% (2.30kB) ⬇️
IntersectionType 135.58kB 133.91kB -1.23% (1.67kB) ⬇️
is_redundant_with_impl::interned_arguments 220.34kB 218.71kB -0.74% (1.63kB) ⬇️
GenericAlias 188.86kB 187.38kB -0.78% (1.48kB) ⬇️
is_redundant_with_impl 173.21kB 171.77kB -0.83% (1.44kB) ⬇️
... 11 more

sphinx

Name Old New Diff Outcome
infer_expression_types_impl 23.10MB 22.98MB -0.52% (123.39kB) ⬇️
member_lookup_with_policy_inner 6.13MB 6.10MB -0.55% (34.41kB) ⬇️
Type<'db>::class_member_with_policy_ 5.10MB 5.07MB -0.63% (32.93kB) ⬇️
TupleType<'db>::to_class_type_ 176.39kB 161.49kB -8.45% (14.90kB) ⬇️
member_lookup_with_policy_inner::interned_arguments 2.70MB 2.69MB -0.52% (14.53kB) ⬇️
Type<'db>::apply_specialization_inner_ 1.53MB 1.52MB -0.82% (12.86kB) ⬇️
UnionType 580.66kB 567.89kB -2.20% (12.77kB) ⬇️
Type<'db>::class_member_with_policy_::interned_arguments 2.36MB 2.35MB -0.52% (12.59kB) ⬇️
Specialization 1.41MB 1.40MB -0.67% (9.73kB) ⬇️
Type<'db>::apply_specialization_inner_::interned_arguments 1.54MB 1.54MB -0.55% (8.67kB) ⬇️
GenericAlias 618.75kB 612.42kB -1.02% (6.33kB) ⬇️
infer_definition_types 19.55MB 19.55MB -0.03% (5.45kB) ⬇️
IntersectionType 552.90kB 547.48kB -0.98% (5.42kB) ⬇️
StaticClassLiteral<'db>::try_mro_ 2.48MB 2.48MB +0.18% (4.47kB) ⬇️
is_redundant_with_impl 905.26kB 901.58kB -0.41% (3.68kB) ⬇️
... 14 more

prefect

Name Old New Diff Outcome
infer_expression_types_impl 56.19MB 55.93MB -0.47% (269.34kB) ⬇️
member_lookup_with_policy_inner 14.71MB 14.69MB -0.13% (19.63kB) ⬇️
Type<'db>::class_member_with_policy_ 10.95MB 10.93MB -0.16% (17.45kB) ⬇️
IntersectionType 980.56kB 969.20kB -1.16% (11.37kB) ⬇️
UnionType 1.07MB 1.06MB -0.87% (9.55kB) ⬇️
TupleType<'db>::to_class_type_ 486.16kB 476.76kB -1.93% (9.39kB) ⬇️
infer_definition_types 69.15MB 69.15MB -0.01% (9.32kB) ⬇️
member_lookup_with_policy_inner::interned_arguments 6.73MB 6.72MB -0.11% (7.38kB) ⬇️
infer_scope_types_impl 38.85MB 38.84MB -0.02% (7.09kB) ⬇️
Type<'db>::apply_specialization_inner_ 3.03MB 3.02MB -0.23% (7.02kB) ⬇️
Specialization 2.67MB 2.66MB -0.24% (6.67kB) ⬇️
Type<'db>::class_member_with_policy_::interned_arguments 5.73MB 5.72MB -0.11% (6.40kB) ⬇️
is_redundant_with_impl::interned_arguments 2.34MB 2.33MB -0.21% (4.98kB) ⬇️
Type<'db>::apply_specialization_inner_::interned_arguments 2.95MB 2.94MB -0.16% (4.69kB) ⬇️
GenericAlias 1.10MB 1.10MB -0.39% (4.36kB) ⬇️
... 23 more

@astral-sh-bot

astral-sh-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-argument-type 16 0 0
invalid-key 7 0 0
unresolved-attribute 5 0 0
invalid-assignment 2 0 0
invalid-return-type 1 0 0
possibly-unresolved-reference 1 0 0
unsupported-operator 1 0 0
Total 33 0 0

Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.

Raw diff (33 changes)
cloud-init (https://github.com/canonical/cloud-init)
+ tests/unittests/distros/test_opensuse.py:287:16 error[unresolved-attribute] Object of type `Distro` has no attribute `read_only_root`
+ tests/unittests/distros/test_opensuse.py:308:16 error[unresolved-attribute] Object of type `Distro` has no attribute `read_only_root`
+ tests/unittests/distros/test_opensuse.py:329:16 error[unresolved-attribute] Object of type `Distro` has no attribute `read_only_root`

discord.py (https://github.com/Rapptz/discord.py)
+ discord/audit_logs.py:210:12 error[invalid-return-type] Return type does not match returned value: expected `list[tuple[Object, PermissionOverwrite]]`, found `list[tuple[Role | Member | User | Object, PermissionOverwrite]]`

freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/rpc/telegram.py:579:59 error[invalid-key] Unknown key "status" for TypedDict `RPCAnalyzedDFMsg` (subscripted object has type `RPCStatusMsg | RPCStrategyMsg | RPCProtectionMsg | ... omitted 5 union elements`)
+ freqtrade/rpc/telegram.py:579:59 error[invalid-key] Unknown key "status" for TypedDict `RPCEntryMsg` (subscripted object has type `RPCStatusMsg | RPCStrategyMsg | RPCProtectionMsg | ... omitted 5 union elements`)
+ freqtrade/rpc/telegram.py:579:59 error[invalid-key] Unknown key "status" for TypedDict `RPCExitMsg` (subscripted object has type `RPCStatusMsg | RPCStrategyMsg | RPCProtectionMsg | ... omitted 5 union elements`)
+ freqtrade/rpc/telegram.py:579:59 error[invalid-key] Unknown key "status" for TypedDict `RPCNewCandleMsg` (subscripted object has type `RPCStatusMsg | RPCStrategyMsg | RPCProtectionMsg | ... omitted 5 union elements`)
+ freqtrade/rpc/telegram.py:579:59 error[invalid-key] Unknown key "status" for TypedDict `RPCProtectionMsg` (subscripted object has type `RPCStatusMsg | RPCStrategyMsg | RPCProtectionMsg | ... omitted 5 union elements`)
+ freqtrade/rpc/telegram.py:579:59 error[invalid-key] Unknown key "status" for TypedDict `RPCStrategyMsg` (subscripted object has type `RPCStatusMsg | RPCStrategyMsg | RPCProtectionMsg | ... omitted 5 union elements`)
+ freqtrade/rpc/telegram.py:579:59 error[invalid-key] Unknown key "status" for TypedDict `RPCWhitelistMsg` (subscripted object has type `RPCStatusMsg | RPCStrategyMsg | RPCProtectionMsg | ... omitted 5 union elements`)

psycopg (https://github.com/psycopg/psycopg)
+ tests/test_cursor_common.py:159:24 error[unresolved-attribute] Module `psycopg` has no member `ProgrammingError`
+ tests/test_cursor_common_async.py:157:24 error[unresolved-attribute] Module `psycopg` has no member `ProgrammingError`

pycryptodome (https://github.com/Legrandin/pycryptodome)
+ lib/Crypto/IO/PKCS8.py:210:33 error[invalid-argument-type] Argument to bound method `DerSequence.decode` is incorrect: Expected `bytes`, found `None`
+ lib/Crypto/IO/PKCS8.py:210:45 error[invalid-argument-type] Argument to bound method `DerSequence.decode` is incorrect: Expected `int | None`, found `tuple[Literal[1], Literal[2]]`
+ lib/Crypto/IO/PKCS8.py:211:37 error[invalid-argument-type] Argument to bound method `DerObjectId.decode` is incorrect: Expected `bytes`, found `None`
+ lib/Crypto/IO/PKCS8.py:216:30 error[invalid-argument-type] Argument to bound method `DerObject.decode` is incorrect: Expected `bytes`, found `None`
+ lib/Crypto/IO/PKCS8.py:222:43 error[invalid-argument-type] Argument to bound method `DerObject.decode` is incorrect: Expected `bytes`, found `None`
+ lib/Crypto/PublicKey/ECC.py:833:44 error[invalid-argument-type] Argument to bound method `DerObject.decode` is incorrect: Expected `bytes`, found `None`
+ lib/Crypto/PublicKey/ECC.py:840:57 error[invalid-argument-type] Argument to bound method `DerObjectId.decode` is incorrect: Expected `bytes`, found `None`
+ lib/Crypto/PublicKey/ECC.py:865:62 error[invalid-argument-type] Argument to bound method `DerBitString.decode` is incorrect: Expected `bytes`, found `None`
+ lib/Crypto/PublicKey/RSA.py:700:22 error[invalid-argument-type] Method `__getitem__` of type `bound method DerSequence.__getitem__(n: int) -> None` cannot be called with key of type `slice[Literal[1], Literal[6], None]` on object of type `DerSequence`
+ lib/Crypto/PublicKey/RSA.py:700:22 error[unsupported-operator] Operator `+` is not supported between objects of type `None` and `list[IntegerBase]`
+ lib/Crypto/PublicKey/RSA.py:700:42 error[invalid-argument-type] Argument to `IntegerBase.__init__` is incorrect: Expected `IntegerBase | int`, found `None`
+ lib/Crypto/PublicKey/RSA.py:700:58 error[invalid-argument-type] Argument to bound method `IntegerBase.inverse` is incorrect: Expected `IntegerBase | int`, found `None`

scrapy (https://github.com/scrapy/scrapy)
+ tests/test_http_response.py:328:35 error[invalid-argument-type] Argument to bound method `Response.follow_all` is incorrect: Expected `Iterable[str | Link]`, found `None`
+ tests/test_http_response.py:330:35 error[invalid-argument-type] Argument to bound method `Response.follow_all` is incorrect: Expected `Iterable[str | Link]`, found `Literal[12345]`
+ tests/test_http_response.py:332:35 error[invalid-argument-type] Argument to bound method `Response.follow_all` is incorrect: Expected `Iterable[str | Link]`, found `list[None]`

trio (https://github.com/python-trio/trio)
+ src/trio/_core/_tests/test_run.py:2440:24 error[invalid-assignment] Object of type `Value[object] | Error` is not assignable to `Outcome[str] | None`
+ src/trio/_core/_tests/test_run.py:2457:34 error[invalid-argument-type] Argument to bound method `CoroutineType.send` is incorrect: Expected `Outcome[object]`, found `None`
+ src/trio/_core/_tests/test_run.py:2470:24 error[invalid-argument-type] Argument to bound method `CoroutineType.send` is incorrect: Expected `Outcome[object]`, found `None`

werkzeug (https://github.com/pallets/werkzeug)
+ tests/test_test.py:150:9 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["test_int"]` and value of type `Literal[1]` on object of type `MultiDict[str, str]`

xarray (https://github.com/pydata/xarray)
+ xarray/tests/test_cftime_offsets.py:326:22 warning[possibly-unresolved-reference] Name `expected` used when possibly not defined

Full report with detailed diff (timing results)

@charliermarsh charliermarsh disabled auto-merge June 24, 2026 00:46
@charliermarsh charliermarsh enabled auto-merge (squash) June 24, 2026 00:46
@charliermarsh charliermarsh merged commit e39ded7 into main Jun 24, 2026
62 checks passed
@charliermarsh charliermarsh deleted the revert-26290-charlie/infer-equality-comparison-results branch June 24, 2026 00:48
@codspeed-hq

codspeed-hq Bot commented Jun 24, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 25.3%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 70 untouched benchmarks
⏩ 64 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation ty_micro[literal_equality_fallthrough_guarded_any] 164.9 ms 131.6 ms +25.3%

Tip

Curious why this is faster? Use the CodSpeed MCP and ask your agent.


Comparing revert-26290-charlie/infer-equality-comparison-results (6292dfa) with main (a30ba16)

Open in CodSpeed

Footnotes

  1. 64 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant