Skip to content

Conversation

@Abhi210
Copy link
Contributor

@Abhi210 Abhi210 commented Oct 24, 2025

This PR references gh-11521. It removes deprecated functionality and cleans up outdated code paths:

  • Removed the deprecated style parameter from array2string in numpy/_core/arrayprint.py, along with its related documentation and tests.
  • Replaced the deprecation warning for np.sum called on generators with a TypeError in numpy/_core/fromnumeric.py, since this behavior is now unsupported.
  • Removed a leftover docstring that was intended to be deleted in PR API: Disallow 0D input arrays in nonzero #26268.

@jorenham
Copy link
Member

jorenham commented Oct 24, 2025

As you can see in the failing stubtest CI jobs, you'll also need to update the .pyi stubs to
match these changes.


edit: actually I see now that it's a different issue, I'll have a closer look

@jorenham jorenham added the 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes label Oct 24, 2025
@Abhi210 Abhi210 force-pushed the gh-11521-core-deprecations branch 8 times, most recently from 0a478ce to 1457704 Compare October 24, 2025 17:41
…d cleans up outdated code paths:

- Removed the deprecated `style` parameter from `array2string` in `numpy/_core/arrayprint.py`, along with its related documentation and tests.
- Replaced the deprecation warning for `np.sum` called on generators with a `TypeError` in `numpy/_core/fromnumeric.py`, since this behavior is now unsupported.
- Removed a leftover docstring that was intended to be deleted in PR numpy#26268.
@Abhi210 Abhi210 force-pushed the gh-11521-core-deprecations branch from 1457704 to 41cebd0 Compare October 25, 2025 03:13
Copy link
Member

@mattip mattip left a comment

Choose a reason for hiding this comment

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

Looks good, a few formatting/comment nits.


* The ``style`` parameter has been removed from ``numpy.array2string``. This argument had no effect since Numpy 1.14.0.

* Calling ``np.sum(generator)`` directly on a generator object now raises a `TypeError`. This behavior was deprecated in NumPy 1.15.0. Use ``np.sum(np.fromiter(generator))`` or the python ``sum`` builtin instead.
Copy link
Member

Choose a reason for hiding this comment

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

Why doesn't the linter complain about this long line? Please reflow the note to 88 columns.

Copy link
Contributor Author

@Abhi210 Abhi210 Oct 31, 2025

Choose a reason for hiding this comment

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

I used to check the linting using the ruff tool. However, I found that it can only check the Python files. In requirements/linter_requirements, only ruff, GitPython, and cython-lint are present. And, I checked that none of these linters check the .rst files in the doc/release/upcoming_changes directory. So, python tools/linter.py passes successfully. Is there any linting tool to check those .rst files?

@Abhi210 Abhi210 force-pushed the gh-11521-core-deprecations branch from dfcbaec to 080b499 Compare October 31, 2025 07:20
@Abhi210 Abhi210 force-pushed the gh-11521-core-deprecations branch from 080b499 to e535e3c Compare October 31, 2025 08:51
@mattip mattip merged commit 4dab17d into numpy:main Nov 2, 2025
80 checks passed
@mattip
Copy link
Member

mattip commented Nov 2, 2025

Thanks @Abhi210

@mhvk
Copy link
Contributor

mhvk commented Nov 3, 2025

Hmm, this cleanup is causing problems in astropy because the order of positional arguments changed for array2string. Clearly, we can fix this, but would it be an idea to make everything after prefix keyword only? Almost certainly, there is not much code out there that uses positional up to >=6 arguments, but if there is, one gets weird errors.

@jorenham
Copy link
Member

jorenham commented Nov 3, 2025

would it be an idea to make everything after prefix keyword only?

Yea seems like a good idea to me

@mhvk
Copy link
Contributor

mhvk commented Nov 4, 2025

OK, thanks! See #30139.

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

Labels

03 - Maintenance 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants