Skip to content

Conversation

@corona10
Copy link
Member

@corona10 corona10 commented Mar 20, 2020

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

IMHO such helper function deserves to be added to the limited C API. I know that I said the opposite a few days ago ;-) But now I can review its implementation and how it's used in practice ;-)

Modules/_weakref.c would also benefit of this helper function. Well, I get that almost all C extension would benefit of this helper. But let's start with the current PR + _weakref, and then write a second PR to convert all other C extension to PyModule_AddType() at once.

@corona10
Copy link
Member Author

@vstinner
Hey Victor, unfortunately, _weakref is not the case for this time.
For example _PyWeakref_RefType tp_name is weakref but on _weakref.c adds this type object as ref.
So I add the new case with _lzmamodule for this function.

@corona10 corona10 requested a review from vstinner March 21, 2020 14:26
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

Can you please rename _PyModule_AddType to PyModule_AddType() to make it public? Names starting with _Py are private functions.

@vstinner vstinner changed the title bpo-40024: Add _PyModule_AddType helper function. bpo-40024: Add PyModule_AddType() helper function Mar 21, 2020
@corona10 corona10 requested a review from vstinner March 22, 2020 06:48
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM. Just a last request on the documentation.

Co-Authored-By: Victor Stinner <[email protected]>
@corona10
Copy link
Member Author

@vstinner
Thanks for the review. I apply the suggestion!

@vstinner vstinner merged commit 05e4a29 into python:master Mar 22, 2020
@vstinner
Copy link
Member

Merged, thanks.

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.

4 participants