Content-Length: 263126 | pFad | http://github.com/numpy/numpy/issues/28957

9D TYP: inplace arithmetic erroneously suggests that `__ifloordiv__` is supported for `complex128` · Issue #28957 · numpy/numpy · GitHub
Skip to content

TYP: inplace arithmetic erroneously suggests that __ifloordiv__ is supported for complex128 #28957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MarcoGorelli opened this issue May 14, 2025 · 4 comments · Fixed by #28958

Comments

@MarcoGorelli
Copy link
Member

Describe the issue:

Type hints suggests that inplace floor division is supported for complex arrays, but it raises at runtime

Reproduce the code example:

import numpy as np
from typing import Any

def func(a: np.ndarray[Any, np.dtype[np.complex128]]) -> None:
    a //= 2

func(np.array([1 + 2j]))

Error message:

No error when type checking

But, at runtime:

TypeError: ufunc 'floor_divide' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Python and NumPy Versions:

2.2.5
3.12.5 (main, Aug 14 2024, 05:08:31) [Clang 18.1.8 ]

Type-checker version and settings:

pyright 1.1.398

Additional typing packages.

No response

@jorenham
Copy link
Member

For what it's worth; this has already been fixed in NumType.

@MarcoGorelli
Copy link
Member Author

nice! gonna use that a reference then, should have something in not too long

@jorenham
Copy link
Member

nice! gonna use that a reference then, should have something in not too long

Oh woops, I missed this, and already opened a PR 😅

@MarcoGorelli
Copy link
Member Author

😄 even better thanks!

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

Successfully merging a pull request may close this issue.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/numpy/numpy/issues/28957

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy