Skip to content

MAINT: add missing space in warning and error messages (#32405) - #32428

Merged
charris merged 1 commit into
numpy:maintenance/2.5.xfrom
charris:backport-32405
Aug 25, 2026
Merged

MAINT: add missing space in warning and error messages (#32405)#32428
charris merged 1 commit into
numpy:maintenance/2.5.xfrom
charris:backport-32405

Conversation

@charris

@charris charris commented Aug 25, 2026

Copy link
Copy Markdown
Member

Backport of #32405.

PR summary

Five user-facing messages run two sentences together because adjacent string
literals are concatenated without a trailing space:

>>> np.sum(i for i in range(3))
TypeError: Calling np.sum(generator) is deprecated.Use np.sum(...)

This is the counterpart of b8c885d ("DOC: add space between words across
lines"), which fixed the format 3.0 warning in what is now _format_impl.py
(then numpy/lib/format.py); the format 2.0 warning five lines above it still
lacks the space. The other sites are in _core/fromnumeric.py,
ma/mrecords.py, and lib/_twodim_base_impl.py (×2).

One space per site, no logic changed. These are all the occurrences I found in
the package — similar-looking joins that are intentional (the regex fragments in
_core/_internal.py, the C macro template in code_generators/genapi.py,
fragments whose continuation begins with \n) were left alone. No test asserts
across any of these boundaries.

First time committer introduction

Hi, I work in Python for data analysis and data science, and lately I've been
building LLM agents on the side. I was reading through the error-handling code
of another library when I noticed this string-concatenation pattern, and since
NumPy is the library I use most, I checked whether it had the same issue — it
did, in five places. This is my first contribution to NumPy.

AI Disclosure

I used an AI assistant (Claude) to help scan for these sites and to draft and
polish this description. I ran and verified everything myself: all five messages
were reproduced locally on NumPy 2.5.2, the excluded cases were reviewed one by
one, and the 2019 precedent was confirmed in the git history. The change is five
single-space insertions with no logic change.

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
@charris charris added this to the 2.5.3 release milestone Aug 25, 2026
@charris charris added 03 - Maintenance 08 - Backport Used to tag backport PRs labels Aug 25, 2026
@charris
charris merged commit 436ee3a into numpy:maintenance/2.5.x Aug 25, 2026
109 of 111 checks passed
@charris
charris deleted the backport-32405 branch August 25, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

03 - Maintenance 08 - Backport Used to tag backport PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants