Skip to content

MAINT: Use Python C API functions for f2py error formatting#31584

Open
da-woods wants to merge 2 commits into
numpy:mainfrom
da-woods:error-formatting
Open

MAINT: Use Python C API functions for f2py error formatting#31584
da-woods wants to merge 2 commits into
numpy:mainfrom
da-woods:error-formatting

Conversation

@da-woods

@da-woods da-woods commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

PR summary

My original interest here was to eliminate the non-limited API access to ->tp_name (and thus it's kind of part of #21300). However, looking at what I was changing, it seemed like a large amount of C string handling could be removed in the process (and because the result inevitably ends up in Python strings, I don't think this is any less efficient).

The main effect is to eliminate a bunch of fixed-size string buffers and the possibility for overflowing those.

Hopefully most of the output should be identical. There's one place where I've updated a test because the output is slightly different and the old version really didn't make sense to me.

AI Disclosure

All code and text was written by me. I used copilot to find a silly mistake I'd made that was causing it to crash (because I couldn't get gdb and spin to cooperate here) and to sanity check what I'd done.

My original interest here was to eliminate the non-limited API
access to `->tp_name`. However, looking at what I was changing,
it seemed like a large amount of C string handling could be removed
in the process (and because the result inevitably ends up in
Python strings, I don't think this is any less efficient).

The main effect is to eliminate a bunch of fixed-size string buffers
and the possibility for overflowing those.

Hopefully most of the output should be identical. There's
one place where I've updated a test because the output is slightly
different and the old version really didn't make sense to me.
@da-woods da-woods changed the title Use Python C API functions for f2py error formatting MAINT: Use Python C API functions for f2py error formatting Jun 9, 2026
available in earlier limited API versions
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.

2 participants