Skip to content

TYP: Better ndarray binop return types for float64 & complex128 - #28108

Merged
charris merged 1 commit into
numpy:mainfrom
jorenham:typing/better-ndarray-arithmetic-binops-for-float64-and-complex128
Jan 6, 2025
Merged

charris merged 1 commit into
numpy:mainfrom
jorenham:typing/better-ndarray-arithmetic-binops-for-float64-and-complex128

Conversation

@jorenham

@jorenham jorenham commented Jan 6, 2025 •

Copy link
Copy Markdown
Member

This improved the return types of the following numpy.ndarray methods:

  • __[r]add__
  • __[r]sub__
  • __[r]mul__
  • __[r]matmul__
  • __[r]truediv__
  • __[r]floordiv__
  • __[r]mod__
  • __[r]divmod__
  • __[r]pow__

Closes #20099 (not sure why, but a win is a win 🤷🏻)
Closes #22631
Closes #27957
Closes #27965
Closes #28071
Towards #28076 (I'm guessing that this fixes something between 75%~95% of the possible 2.2.0 typing issues)

@jorenham jorenham added the 09 - Backport-Candidate PRs tagged should be backported label Jan 6, 2025
@jorenham

jorenham commented Jan 6, 2025

Copy link
Copy Markdown
Member Author

I'm not sure what's going on with the CI, but I doubt that this change has anything to do with it:

Problem: 1: the to be installed gcc-c++-14-2.1.x86_64 requires 'gcc = 14', but this requirement cannot be provided
not installable providers: gcc-14-2.1.x86_64[repo-oss]

 Solution 1: downgrade of libcrypt1-4.4.37-1.1.x86_64 to libcrypt1-4.4.36-1.6.x86_64
 Solution 2: do not install gcc-c++-14-2.1.x86_64
 Solution 3: break gcc-c++-14-2.1.x86_64 by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/3/c/d/?] (c): c

@charris

charris commented Jan 6, 2025

Copy link
Copy Markdown
Member

I'm not sure what's going on with the CI,

I suspect it was a network/update problem upstream. It is working now.

@charris
charris merged commit 1b25ef5 into numpy:main Jan 6, 2025
@charris

charris commented Jan 6, 2025

Copy link
Copy Markdown
Member

Thanks Joren.

@oscarbenjamin

Copy link
Copy Markdown

Yes, thanks.

@jorenham
jorenham deleted the typing/better-ndarray-arithmetic-binops-for-float64-and-complex128 branch January 6, 2025 23:24
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.

TYP: inconsistent static typing of float64 addition TYP: Suboptimally annotated arithmetic operator types TYP: regression between 2.1.3 and 2.2.0 (mypy only) numpy.typing uint8 becomes signedinteger on multiplication BUG: NDArray[Any] methods ignore overload ambiguity

3 participants