Skip to content

ENH: Use PyModule_AddObjectRef in _umath_linalg#31976

Open
prathamhole14 wants to merge 1 commit into
numpy:mainfrom
prathamhole14:umath_linalg_limitedapi
Open

ENH: Use PyModule_AddObjectRef in _umath_linalg#31976
prathamhole14 wants to merge 1 commit into
numpy:mainfrom
prathamhole14:umath_linalg_limitedapi

Conversation

@prathamhole14

@prathamhole14 prathamhole14 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

PR summary

In the PyModule_GetDict's docs it's mentioned:
It is recommended extensions use other PyModule_* and PyObject_* functions rather than directly manipulate a module’s [__dict__].

I also noticed PyDict_SetItemString can fail (returns -1) ref , but in the current code the return value was ignored. (Edited)

AI Disclosure

Final review with claude, it suggested to change dictionary word to module in addUfuncs

@mattip

mattip commented Jul 12, 2026

Copy link
Copy Markdown
Member

PyDict_SetItemString is part of the stable ABI, what motivated changing it for PyModule_AddObjectRef?

@prathamhole14

Copy link
Copy Markdown
Contributor Author

In the PyModule_GetDict's docs it's mentioned:
It is recommended extensions use other PyModule_* and PyObject_* functions rather than directly manipulate a module’s [__dict__].

I also noticed PyDict_SetItemString can fail (returns -1) ref , but in the current code the return value was ignored.

Yes, this is not a "mandatory" but since I was auditing _umath_liang I thought we should do this.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants