Skip to content

fix(stubs): support builtin float with NumPy float64 - #5367

Closed
mangeshraut712 wants to merge 5 commits into
meta:mainfrom
mangeshraut712:fix/numpy-float64-ops
Closed

mangeshraut712 wants to merge 5 commits into
meta:mainfrom
mangeshraut712:fix/numpy-float64-ops

Conversation

@mangeshraut712

@mangeshraut712 mangeshraut712 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #5353: arithmetic and comparisons between numpy.float64 and builtin float reported unsupported-operation under tensor-shapes stubs.

Narrow approach: add float-specific overloads on float64 for __sub__/__rsub__ and rich comparisons. Do not inherit builtins.float — that rewrote reflected ops like 1j * float64 via complex*float and failed dtype-properties (assert_type regression: expected 5 errors, got 6).

Test plan

  • Focused float64↔float sub/rsub/comparison coverage (assert_type + runtime)
  • CI tensor-shape checks green on this tip

@meta-codesync

meta-codesync Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D127482799. (Because this pull request was imported automatically, there will not be any future comments.)

Inheriting builtins.float made ``1j * float64`` resolve via complex*float
and broke dtype-properties assert_type (expected 5 errors, got 6).

Add float-specific overloads for __sub__/__rsub__ and comparisons only,
matching issue meta#5353 without rewriting reflected numeric ops.
@github-actions github-actions Bot added size/s and removed size/xs labels Oct 25, 2026
@github-actions github-actions Bot added size/s and removed size/s labels Oct 25, 2026
Runtime harness rejects tests that only use plain assert/assert_type.
@github-actions github-actions Bot added size/s and removed size/s labels Oct 25, 2026
Same flake as elsewhere: commands::check::tests::check_writes_cinderx_and_glean_reports_together
(assertion failed: facts.contains("public.api.Widget")). Ubuntu + tensor-shape remain green.
@github-actions github-actions Bot added size/s and removed size/s labels Oct 25, 2026

@stroxler stroxler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@meta-codesync

meta-codesync Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

This pull request has been merged in 8fac146.

@mangeshraut712

Copy link
Copy Markdown
Contributor Author

Hey — CodeSync landed this on main with me as the commit author (thanks). GitHub still shows the PR as closed not merged (mergedAt is null), so it does not show up in is:merged search or contributor merge counts.

Could you mark CodeSync landings as merged on the GitHub side (or reopen + merge via GitHub) so external contributors get the PR merge credit? Same issue on #5365 #5373 #5367 #5369.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

- is not supported between float64 and float [unsupported-operation]

2 participants