Skip to content

Conversation

skirpichev
Copy link
Contributor

@skirpichev skirpichev commented Aug 28, 2025

  • use "defining class" converter, where possible
  • convert Context._unsafe* to Argument Clinic

Use "defining class" converter, where possible.
@skirpichev skirpichev requested review from AA-Turner and serhiy-storchaka and removed request for AA-Turner August 28, 2025 11:40
@skirpichev skirpichev force-pushed the ac-decimal/73487-pt7 branch from b335e44 to c7f9471 Compare August 28, 2025 13:21
@skirpichev skirpichev marked this pull request as ready for review August 28, 2025 14:23
Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

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

Looks ok from a desk review, barring Serhiy's comments.

A

@AA-Turner AA-Turner changed the title gh-73487: Convert _decimal to use Argument Clinic (part 7) gh-73487: Convert _decimal to use Argument Clinic (part 7) Sep 1, 2025
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

Are there any uses of get_module_state_by_def() left?

@skirpichev
Copy link
Contributor Author

skirpichev commented Sep 2, 2025

Are there any uses of get_module_state_by_def() left?

Yes, a lot:

$ git grep get_module_state_by_def Modules/_decimal
Modules/_decimal/_decimal.c:get_module_state_by_def(PyTypeObject *tp)
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(Py_TYPE(self));
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(Py_TYPE(self));
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(Py_TYPE(self));
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(Py_TYPE(self));
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(Py_TYPE(v));
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(Py_TYPE(self));
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(type);
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(type);
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(Py_TYPE(dec));
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(Py_TYPE(dec));
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(Py_TYPE(self));
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(Py_TYPE(self));   \
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(Py_TYPE(dec));
Modules/_decimal/_decimal.c:    decimal_state *state = get_module_state_by_def(Py_TYPE(self));

I'll double check, some case could be converted to use "defining class" converter (e.g. _decimal.Decimal.as_tuple), but not all.

Edit: I think nothing left.

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.

3 participants