Skip to content

Revert "[ty] Completely remove the NoReturn shortcut optimization"#23955

Merged
sharkdp merged 1 commit intomainfrom
david/revert-noreturn
Mar 14, 2026
Merged

Revert "[ty] Completely remove the NoReturn shortcut optimization"#23955
sharkdp merged 1 commit intomainfrom
david/revert-noreturn

Conversation

@sharkdp
Copy link
Contributor

@sharkdp sharkdp commented Mar 14, 2026

Summary

This reverts commit 85a8516.

@sharkdp sharkdp added internal An internal refactor or improvement ty Multi-file analysis & type inference labels Mar 14, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 14, 2026

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 85.29%. The percentage of expected errors that received a diagnostic held steady at 78.13%. The number of fully passing files held steady at 64/132.

@sharkdp sharkdp enabled auto-merge (squash) March 14, 2026 13:40
@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 14, 2026

mypy_primer results

Changes were detected when running on open source projects
pip (https://github.com/pypa/pip)
+ src/pip/_vendor/packaging/version.py:48:24: error[call-non-callable] Object of type `object` is not callable
- Found 655 diagnostics
+ Found 656 diagnostics

pydantic (https://github.com/pydantic/pydantic)
- pydantic/v1/utils.py:613:16: error[invalid-return-type] Return type does not match returned value: expected `Mapping[int | str, Any]`, found `(AbstractSet[int | str] & Top[Mapping[Unknown, object]]) | Mapping[int | str, Any] | dict[int | str, ellipsis]`
+ pydantic/v1/utils.py:613:16: error[invalid-return-type] Return type does not match returned value: expected `Mapping[int | str, Any]`, found `(AbstractSet[int | str] & Top[Mapping[Unknown, object]]) | (Mapping[int | str, Any] & AbstractSet[object]) | (Mapping[int | str, Any] & ~AbstractSet[object]) | dict[int | str, ellipsis]`

trio (https://github.com/python-trio/trio)
- src/trio/_core/_tests/test_run.py:2440:49: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- Found 470 diagnostics
+ Found 469 diagnostics

setuptools (https://github.com/pypa/setuptools)
+ setuptools/_vendor/packaging/version.py:48:24: error[call-non-callable] Object of type `object` is not callable
- Found 1124 diagnostics
+ Found 1125 diagnostics

egglog-python (https://github.com/egraphs-good/egglog-python)
+ python/egglog/egraph.py:1962:24: error[invalid-argument-type] Argument to function `expr_action` is incorrect: Expected `BaseExpr`, found `(BaseExpr & ~Action) | (Fact & ~Action)`
- Found 1474 diagnostics
+ Found 1475 diagnostics

hydpy (https://github.com/hydpy-dev/hydpy)
+ hydpy/core/devicetools.py:2425:9: error[type-assertion-failure] Type `Literal["inlets", "outlets", "observers", "receivers", "senders", "inputs", "outputs"]` is not equivalent to `Never`
- Found 1080 diagnostics
+ Found 1081 diagnostics

@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 14, 2026

Memory usage report

Summary

Project Old New Diff Outcome
prefect 699.63MB 706.23MB +0.94% (6.60MB)
sphinx 264.23MB 265.95MB +0.65% (1.72MB)
trio 116.47MB 118.03MB +1.34% (1.56MB)
flake8 48.11MB 48.05MB -0.13% (64.08kB) ⬇️

Significant changes

Click to expand detailed breakdown

prefect

Name Old New Diff Outcome
infer_expression_types_impl 55.78MB 60.90MB +9.18% (5.12MB)
semantic_index 171.55MB 173.44MB +1.10% (1.89MB)
Expression 6.74MB 8.51MB +26.21% (1.77MB)
infer_definition_types 90.18MB 88.99MB -1.32% (1.19MB)
all_narrowing_constraints_for_expression 7.33MB 7.01MB -4.36% (327.39kB)
infer_expression_type_impl 14.69MB 14.39MB -2.05% (308.18kB)
CallableType 1.59MB 1.88MB +17.93% (292.80kB)
StaticClassLiteral<'db>::implicit_attribute_inner_ 10.00MB 9.79MB -2.17% (221.82kB)
all_negative_narrowing_constraints_for_expression 2.80MB 2.61MB -6.98% (200.22kB)
Type<'db>::member_lookup_with_policy_ 16.08MB 15.89MB -1.17% (192.12kB)
Type<'db>::class_member_with_policy_ 17.55MB 17.43MB -0.68% (121.59kB)
BoundMethodType<'db>::into_callable_type_ 186.57kB 306.39kB +64.22% (119.81kB)
loop_header_reachability 533.67kB 436.16kB -18.27% (97.51kB)
infer_scope_types_impl 52.90MB 52.96MB +0.11% (60.48kB)
Type<'db>::try_call_dunder_get_ 10.50MB 10.51MB +0.11% (11.53kB)
... 28 more

sphinx

Name Old New Diff Outcome
infer_expression_types_impl 19.93MB 21.59MB +8.32% (1.66MB)
semantic_index 61.79MB 62.50MB +1.14% (720.29kB)
Expression 2.50MB 3.17MB +26.76% (685.48kB)
infer_expression_type_impl 3.86MB 3.22MB -16.47% (650.98kB)
infer_definition_types 24.62MB 24.07MB -2.24% (563.57kB)
CallableType 923.96kB 1.07MB +18.83% (174.02kB)
all_narrowing_constraints_for_expression 2.49MB 2.35MB -5.90% (150.49kB)
loop_header_reachability 525.22kB 383.40kB -27.00% (141.82kB)
BoundMethodType<'db>::into_callable_type_ 175.89kB 278.46kB +58.32% (102.57kB)
all_negative_narrowing_constraints_for_expression 1.09MB 1.01MB -7.10% (79.32kB)
infer_scope_types_impl 15.57MB 15.59MB +0.12% (19.23kB)
UnionType<'db>::from_two_elements_ 1.36MB 1.35MB -0.69% (9.64kB)
infer_unpack_types 454.55kB 446.49kB -1.77% (8.05kB)
is_redundant_with_impl::interned_arguments 2.08MB 2.07MB -0.33% (6.96kB)
UnionType 1.24MB 1.23MB -0.42% (5.30kB)
... 26 more

trio

Name Old New Diff Outcome
infer_expression_types_impl 6.10MB 7.08MB +16.00% (999.12kB)
Expression 1.09MB 1.41MB +28.67% (321.33kB)
semantic_index 30.04MB 30.33MB +0.97% (298.10kB)
infer_expression_type_impl 1.52MB 1.43MB -6.13% (95.66kB)
CallableType 489.79kB 572.29kB +16.84% (82.50kB)
all_narrowing_constraints_for_expression 639.81kB 601.43kB -6.00% (38.38kB)
BoundMethodType<'db>::into_callable_type_ 43.76kB 75.16kB +71.77% (31.41kB)
all_negative_narrowing_constraints_for_expression 213.03kB 184.88kB -13.22% (28.16kB)
infer_scope_types_impl 4.77MB 4.79MB +0.48% (23.50kB)
loop_header_reachability 139.52kB 134.84kB -3.35% (4.67kB)
infer_deferred_types 2.36MB 2.37MB +0.11% (2.73kB)
Type<'db>::member_lookup_with_policy_ 1.82MB 1.82MB -0.13% (2.50kB)
is_redundant_with_impl::interned_arguments 536.94kB 539.26kB +0.43% (2.32kB)
is_redundant_with_impl 475.66kB 477.89kB +0.47% (2.23kB)
StaticClassLiteral<'db>::implicit_attribute_inner_ 753.23kB 751.04kB -0.29% (2.19kB)
... 35 more

flake8

Name Old New Diff Outcome
infer_definition_types 1.96MB 1.87MB -4.69% (94.31kB) ⬇️
infer_expression_type_impl 213.58kB 157.40kB -26.30% (56.18kB) ⬇️
semantic_index 13.79MB 13.83MB +0.34% (48.51kB) ⬇️
infer_expression_types_impl 1.03MB 1.07MB +3.19% (33.84kB) ⬇️
Expression 334.62kB 365.70kB +9.29% (31.08kB) ⬇️
loop_header_reachability 43.39kB 13.70kB -68.44% (29.70kB) ⬇️
CallableType 142.38kB 166.08kB +16.64% (23.70kB) ⬇️
all_narrowing_constraints_for_expression 102.54kB 82.57kB -19.47% (19.96kB) ⬇️
BoundMethodType<'db>::into_callable_type_ 13.43kB 26.96kB +100.79% (13.54kB) ⬇️
infer_unpack_types 48.64kB 37.86kB -22.16% (10.78kB) ⬇️
all_negative_narrowing_constraints_for_expression 45.98kB 40.25kB -12.45% (5.73kB) ⬇️
infer_scope_types_impl 1001.57kB 1003.61kB +0.20% (2.04kB) ⬇️
IntersectionType<'db>::from_two_elements_::interned_arguments 20.54kB 20.45kB -0.42% (88.00B) ⬇️
IntersectionType<'db>::from_two_elements_ 19.35kB 19.30kB -0.28% (56.00B) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 312.51kB 312.52kB +0.00% (12.00B) ⬇️
... 1 more

@sharkdp sharkdp merged commit 3bfdb12 into main Mar 14, 2026
51 checks passed
@sharkdp sharkdp deleted the david/revert-noreturn branch March 14, 2026 13:43
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 14, 2026

Merging this PR will degrade performance by 4.07%

❌ 1 regressed benchmark
✅ 25 untouched benchmarks
⏩ 30 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime pandas 77.8 s 81.1 s -4.07%

Comparing david/revert-noreturn (71b95b5) with main (85a8516)

Open in CodSpeed

Footnotes

  1. 30 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.

carljm added a commit that referenced this pull request Mar 16, 2026
* main: (131 commits)
  [ty] Fixup examples in `invalid-key` docs (#23968)
  [ty] Fix compiler warning about unused variable (#23967)
  [ty] Sync vendored typeshed stubs (#23963)
  Add a `.git-blame-ignore-revs` file (#23959)
  Revert "[ty] Completely remove the `NoReturn` shortcut optimization" (#23955)
  [ty] Completely remove the `NoReturn` shortcut optimization (#23378)
  [ty] Introduce fast path for protocol non-assignability (#23952)
  Bump typing conformance suite SHA (#23951)
  Minor followup to severity display - use preview function in server instead of checking preview disabled directly (#23950)
  Document editor features for markdown code formatting (#23924)
  [ty] Add `with_recursion_guard()` helpers to `relation.rs` (#23945)
  [ty] Remove `check_optional_method_pair` methods (#23947)
  [ty] Remove unused `CycleDetector::try_visit` method (#23944)
  [ty] Ensure TypedDict subscripts for unknown keys return Unknown (#23926)
  [ty] Fix variance of frozen dataclass-transform models (#23931)
  Display output severity in preview (#23845)
  Revert "[`ruff`] use `bitcode` instead of `bincode`" (#23935)
  Fix shell injection via `shell=True` in subprocess calls (#23894)
  [ty] Refactor `relation.rs` to store state on a struct rather than passing around 7 arguments every time we recurse (#23837)
  Don't return code actions for non-Python documents (#23905)
  ...
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.

3 participants