Skip to content

MNT: add linter for thread-unsafe C API uses #29371

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

Merged
merged 2 commits into from
Jul 16, 2025
Merged

Conversation

lvllvl
Copy link
Contributor

@lvllvl lvllvl commented Jul 14, 2025

Adding a linter to audit PRs.
This would lint out PRs that use problematic functions such as

  • PyList_GetItem
  • PyList_GET_ITEM
  • PyDict_GetItem
  • PyDict_getItemWithError
  • PyDict_Next
  • PyDict_GetItemString
  • _PyDict_GetItemStringWithError
  • And all the functions listed in this Borrowed Reference table

Attempts to resolve #26159

Previous PR #28634 was closed accidentally.

@lvllvl lvllvl force-pushed the issue-26159 branch 2 times, most recently from 9320d2e to 9f7b3fd Compare July 14, 2025 20:22
@lvllvl lvllvl marked this pull request as ready for review July 14, 2025 20:49
Copy link
Member

@ngoldbaum ngoldbaum left a comment

Choose a reason for hiding this comment

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

Awesome, I think this is ready once you correct my suggestions below. Thanks again for pushing this through!

@lvllvl
Copy link
Contributor Author

lvllvl commented Jul 15, 2025

Awesome, I think this is ready once you correct my suggestions below. Thanks again for pushing this through!

Awesome thanks for your help on this. It was fun to learn about this stuff.

@ngoldbaum
Copy link
Member

@rgommers would you mind giving this a look? I trust your opinion about adding new CI checks and you have context for the free-threading issues.

Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

A few comments. I only looked at CI and linter, not the C API usage.

@lvllvl lvllvl force-pushed the issue-26159 branch 3 times, most recently from 3f1422a to bbd4e18 Compare July 16, 2025 16:50
@lvllvl lvllvl requested a review from rgommers July 16, 2025 16:59
Copy link
Member

@ngoldbaum ngoldbaum left a comment

Choose a reason for hiding this comment

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

A small nit on the latest version then I think this is ready.

Also @lvllvl for future reference, please don't force-push after people have already reviewed your code. It's much easier for a reviewer to understand what changed after a review if you add commits instead of amending.

@ngoldbaum ngoldbaum dismissed rgommers’s stale review July 16, 2025 20:37

All concerns raised in review have been addressed and Ralf asked me to merge once I thought things look good.

@ngoldbaum ngoldbaum merged commit b5d6eb4 into numpy:main Jul 16, 2025
76 checks passed
@ngoldbaum
Copy link
Member

Thanks @lvllvl!

MaanasArora pushed a commit to MaanasArora/numpy that referenced this pull request Jul 16, 2025
* MNT: add extra lint - thread-unsafe C API lint

* MNT: integrate ruff-lint with C-API-lint
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.

MNT: Add linter for thread-unsafe C API uses
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy