Skip to content

Conversation

@encukou
Copy link
Member

@encukou encukou 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

encukou and others added 2 commits October 20, 2020 22:45
Uses code from: python#16078

Co-authored-by: Marcel Plch <[email protected]>
Co-authored-by: Eddie Elizondo <[email protected]>
Co-authored-by: Hai Shi <[email protected]>
assert(PyType_Check(type));
assert(type->tp_mro);
int i;
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
Member Author

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.

@encukou encukou requested review from a team, vsajip and warsaw as code owners November 10, 2020 13:53
@encukou encukou changed the base branch from 3.9 to master November 10, 2020 13:53
@encukou
Copy link
Member Author

encukou commented Nov 10, 2020

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

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.

4 participants