Skip to content

Conversation

@encukou
Copy link
Member

@encukouencukou commented Oct 20, 2020

This PR depends on #22835 and shows how the new _PyType_GetModuleByDef can be used. I would love these to go in as two separate commits.

https://bugs.python.org/issue1635741

encukouand others added 2 commits October 20, 2020 22:45
Uses code from: python#16078 Co-authored-by: Marcel Plch <gmarcel.plch@gmail.com> Co-authored-by: Eddie Elizondo <eduardo.elizondorueda@gmail.com> Co-authored-by: Hai Shi <shihai1992@gmail.com>
assert(PyType_Check(type));
assert(type->tp_mro);
inti;
for (i=0; i<PyTuple_GET_SIZE(type->tp_mro); i++){
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's better to call PyTuple_GET_SIZE before the for loop to only call it once.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It's a macro for direct field access, so it doesn't really matter.

@encukouencukou requested review from a team, vsajip and warsaw as code ownersNovember 10, 2020 13:53
@encukouencukou changed the base branch from 3.9 to masterNovember 10, 2020 13:53
@encukou
Copy link
MemberAuthor

Apologies for the mass review requests. I'll open a new PR.

Sign up for freeto 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.

4 participants

@encukou@koubaa@the-knights-who-say-ni@bedevere-bot